Loading from Bitmap/HBitmap available?

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

ebbiTeam
User
Posts: 17
Joined: Fri May 27, 2011 7:20 am

Loading from Bitmap/HBitmap available?

Post by ebbiTeam »

Hello,
is there a possiblity to load a Bitmap/HBitmap into your viewer component?
As I read there are tree options for loading:
-by file
-by url
-by stream

So my question is if the viewer is only accepting pdf streams or bitmap too?

Thanks and best regards

Tobias Herold
EbbinghausTeam
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19885
Joined: Mon Jan 12, 2009 8:07 am

Re: Loading from Bitmap/HBitmap available?

Post by Stefan - PDF-XChange »

Hello Tobias,

Yes loading from stream is for PDF streams only.

Have a look at section
2.2.1.29 NewDocumentFromImages
in the Viewer AX SDK manual however - for a way to create a new document from images.

Best,
Stefan
ebbiTeam
User
Posts: 17
Joined: Fri May 27, 2011 7:20 am

Re: Loading from Bitmap/HBitmap available?

Post by ebbiTeam »

Thanks for the fast answer. This looks like exactly what I'm looking for.
In the pseudocode-sample the picturesource is directly from file. Is it also possible to load from stream or better hBitmap-pointer?
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19885
Joined: Mon Jan 12, 2009 8:07 am

Re: Loading from Bitmap/HBitmap available?

Post by Stefan - PDF-XChange »

Hello Tobias,

As you would be creating the PDF File from images anyway - it might be better to use the PDF Tools SDK, and then you can add images from HBITMAP directly ( PXC_AddImageFromHBITMAP ), and place them ( PXC_PlaceImage ) on pages inside the document you are creating. You will have better control over the PDF creation process, and you can then always visualize the result in the Viewer.

If you want to stick to using the Viewer SDK only - you will need to save those images to files first it seems.

Best,
Stefan
ebbiTeam
User
Posts: 17
Joined: Fri May 27, 2011 7:20 am

Re: Loading from Bitmap/HBitmap available?

Post by ebbiTeam »

Okay, understood...almost. :)
Though what about the pdf document which is created by the pdf tools SDK...how can I add this one to your viewer control directly from memory? Or have I to store it to hdd at first?
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19885
Joined: Mon Jan 12, 2009 8:07 am

Re: Loading from Bitmap/HBitmap available?

Post by Stefan - PDF-XChange »

Hi Tobias,

I do think you will need to save the generated PDF to file before you can pass it to the Viewer control if you do generate it with the PDF Tools SDK, but I will speak with one of our dev guys to see if they have any better ideas.

Best,
Stefan
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19885
Joined: Mon Jan 12, 2009 8:07 am

Re: Loading from Bitmap/HBitmap available?

Post by Stefan - PDF-XChange »

I stand corrected Tobias,

The guys just pointed me that you could use PXC_WriteDocumentToIStream + PXCV_ReadDocumentFromIStream to achieve what you want.

Best,
Stefan
ebbiTeam
User
Posts: 17
Joined: Fri May 27, 2011 7:20 am

Re: Loading from Bitmap/HBitmap available?

Post by ebbiTeam »

That's very kind of you, thank you.
Hope there's a possibility because using a temporary file might have perfomance issues and working within memory would be much better.
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19885
Joined: Mon Jan 12, 2009 8:07 am

Re: Loading from Bitmap/HBitmap available?

Post by Stefan - PDF-XChange »

:)

Actually I just posted the solution a few seconds before you replied in my previous post.

Best,
Stefan
ebbiTeam
User
Posts: 17
Joined: Fri May 27, 2011 7:20 am

Re: Loading from Bitmap/HBitmap available?

Post by ebbiTeam »

Good work - thanks for the fast and reliable support.
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19885
Joined: Mon Jan 12, 2009 8:07 am

Re: Loading from Bitmap/HBitmap available?

Post by Stefan - PDF-XChange »

:)