Two Pilots™    Home  |  Navigation  |  Site Map  |  Products  |  Download  |  Prices  |  For Partners  |  Support


All forums · Statistics · Search ·

Two Pilots forum / For software developers / Need your help!
Author Message
Anonymous
# Posted: 15 Sep 2005 14:31


Dear,

I want to test GenerateInMemoryFile that can't work in my program by using DLL to return in BinaryImage format and test it in the another program.

Here is my code:
*******DLL*********
#include <comdef.h>
#include "GeneratePDF.h"

_variant_t CGeneratePDF:: RecieveData(const char* Fracc)
{
int rcc = 0;
// initialize OLE
HRESULT hr = CoInitialize(NULL);

// check for errors
if (FAILED(hr)) {
MessageBox(0,"OLE initialization errp","error",MB_OK);
rcc = -1;
};

// declare PDF Creator Pilot object
IpiPDFDocument2* PDF = NULL;
CLSID clsid;

// get inuque ID for PDF Creator Pilot
hr = CLSIDFromProgID(OLESTR("PDFCreatorPilot2.piPDFDocument"), &clsid);

// check for errors
if (FAILED(hr)) {
//MessageBox(0,"Can't get CLSID for PDF Creator Pilot","error",MB_OK);
rcc = -1;
goto Uninit;
};

// create PDF Creator Pilot object
hr = CoCreateInstance(clsid, NULL, CLSCTX_ALL,__uuidof(IpiPDFDocument2), (LPVOID*)&PDF);

// check for errors
if (FAILED(hr) || (PDF == NULL )) {
//MessageBox(0,"Can't create PDF Creator Pilot object","error",MB_OK);
rcc = -1;
goto Uninit;
};


// initialize PDF Engine
PDF->StartEngine("demo@demo.com","demo");
printf("StartEngine PDF\n");
PDF->GenerateInMemoryFile = true;

PDF->BeginDoc();


long img_index;
img_index = PDF->AddImageFromFilename("c:\\Logo.jpg",itcJpeg );
PDF->PDFPAGE_ShowImage(img_index,20,20,200,36,0);
PDF->PDFPAGE_TextOut(200, 280, 0, Fracc);
Uninit:
CoUninitialize();

if (rcc==0) {
printf("Begin BinaryImage PDF\n");
return PDF->BinaryImage;
printf("After BinaryImage PDF\n");
} else {
printf("Begin -1 PDF\n");
return "-1";
printf("-1 PDF\n");
};

// finalize document generation
PDF->EndDoc();
}

and Here is my testing program to call DLL

#include "GeneratePDF.h"


int main(int argc, char* argv[])
{
CGeneratePDF Pdf ;
Pdf.RecieveData("abc");
return 0;
}
if my testing program isn't a good way to test, please guide me (JSP is good).
I must to return in BinaryImage only? How?...Could u give me an example thai not like in your document(ASP)?

Please help! Thanks,
Jan.

Stanislav
# Posted: 15 Sep 2005 15:01


Dear Jan,

I need 2-3 hours to test yuor code.

Thank you very much !

Best regards,
Stanislav
Two Pilots

Stanislav
# Posted: 15 Sep 2005 22:01


Dear Jan,

Pleasу download and examine this code:
http://www.colorpilot.com/~spanasik/TestBinaryImage.zip (7.2 Kb)

There is a sample how to get binary image as a BYTE* buffer which you can use in any suitable way.

Thank you very much !

Best regards,
Stanislav
Two Pilots

Anonymous
# Posted: 16 Sep 2005 08:19


Dear Stanislav,

Thank you very much! I'll try to use it.

Best Regards,
Jan.

Anonymous
# Posted: 19 Sep 2005 09:11


Dear Stanislav,

Is it possible if my DLL has BinaryImage but its just return rc to jsp, is can display in browser in pdf format?

Best Regards,
Jan.

Stanislav
# Posted: 19 Sep 2005 10:28


Dear Jan,

Yes, you can send headers from your JSP, telling that binary PDF data comes. Here is excerpt from our ASP example.

response.ContentType = "application/pdf"
response.AddHeader "Content-Type", "application/pdf"
response.AddHeader "Content-Disposition", "inline;filename=acform.pdf"

Thank you very much !

Best regards,
Stanislav
Two Pilots

Anonymous
# Posted: 19 Sep 2005 13:36


Dear Stanislav ,

So I 'm not nessecary to send BinaryImage (from DLL) to JSP page to display PDF?
(No need to code "response.BinaryWrite PdfImage" in ASP Page.)
Just return rc (0 for success or -1 for unsuccess).

Best regards,
Jan.

Stanislav
# Posted: 19 Sep 2005 17:51


Dear Jan,

Sorry, i don't understand what you want to do - please describe your task.

Thank you very much !

Best regards,
Stanislav
Two Pilots

Anonymous
# Posted: 20 Sep 2005 06:18


Dear Stanislav ,

I have DLL that GenerateInMemoryFile and return BinaryImage to JSP page.
This JSP page is a page to display PDF on browser.

So If I want to return value 0 or -1 (success, unsucces in order) to JSP Page only,is it possiple to JSP page can display PDF? If not,is it require to return BinaryImage to JSP page to display PDF only?

Thanks,
Jan.

Stanislav
# Posted: 20 Sep 2005 10:29


Dear Jan,

JSP page cannot display PDF, because BinaryImage is not rasterized variant of the PDF document, it is binary representation of PDF file. JSP can pass this binary image to the browser, which will open viewer as embedded control, or offer user to save this PDF.

Best regards,
Stanislav
Two Pilots

 

 

Powered by miniBB 2.0 RC7 © 2001-2004 Page creation time (sec.): 0.014

 

Page top