Page 1 of 1

Add a Bitmap from mémory in existing PDF

Posted: Tue May 24, 2016 4:01 pm
by SerLoi
Hello

I'm using Delphi. My goal is to add an image to an existing document.
My image is store in a bitmap in memory at the moment.

I open my document with PXCp_ReadDocumentW.
So I can't use PXC_AddImageFromHBITMAP (I tried and I have an access violation), normal, isn't it ?

On an other way, I use PXCp_AddWatermark, and it works perfectly :)
So the idea is to use PXCp_AddWatermark to print an image to my doc, but this function only loads
a bitmap from disk, not from memory... not very performant i I have to write my bitmap on disk just to be read by this function....

Maybe I'm totally in the wrong way.

What's the better solution to add an image (I have a HBitmap) to my existing PDF ?

Thank you !

Re: Add a Bitmap from mémory in existing PDF

Posted: Tue May 24, 2016 4:13 pm
by Tracker Supp-Stefan
Hello SerLoi,

Our Tools SDK is now no longer actively developed as it has been replaced by the Core API.
Using the Core API it is really easy to do what you want:
https://sdkhelp.pdf-xchange.com/vie ... FromMemory

And in the Tools SDK as you have seen - you can't mix PXCp_ and PXC_ methods (the first are for modifying existing files, the second - for creating new pages/documents).

So is switching from Tools SDK to Core API a viable thing you can consider?

Regards,
Stefan

Re: Add a Bitmap from mémory in existing PDF

Posted: Tue May 24, 2016 4:31 pm
by SerLoi
Thank you for your very fast response.

I think your solution is the best solution.
But unfortunatly I have no time to switch and update my code right now :( ...

And I see you changed the system of licence too, I have to understand all the part or your system first what dll I need and so on :|


So actually, without update, the only way is to write on disk and use watermark ?

Thank you Stefan

Re: Add a Bitmap from mémory in existing PDF

Posted: Wed May 25, 2016 7:05 am
by Tracker Supp-Stefan
Hello SerLoi,

Just spoke with the lead developer for PDF Tools, and he said that with the Tools SDK, you can either use Watermarks as you have discovered or use Overlay (PXCp_PlaceContents). The second way gives you much more options but both will require saving to disk unfortunately.

Regards,
Stefan

Re: Add a Bitmap from mémory in existing PDF

Posted: Wed May 25, 2016 7:40 am
by SerLoi
Hello Stefan

Ok Thank you for your response. I will use this for the moment and I will take a look
with the module 'CORE API'.

Since I use your product in these 3 ways:
- ActiveX integrated in my soft, and printing pdf without show the window
- Virtual Printer
- Tools to merge, create, modify PDF
with auto-install module if needed (for the client), It's not very simple to change and replace to a new module!

Kind regards
Serge

Re: Add a Bitmap from mémory in existing PDF

Posted: Wed May 25, 2016 8:21 am
by Tracker Supp-Stefan
Hi Serge,

The Core API will replace just the Tools SDK component in your product, so you can keep the Viewer AX and Virtual printer components intact.

Regards,
Stefan