I am having issues when attempting to load images.
The following code fails:
this.result = PDFXC_Funcs.PXC_AddImageW(this.pdfObject, newImage, out imageOut);
In the above case I can confirm that I have a valid pdfObject and the newImage(string path to JPG or TIFF file) is valid and the file is not locked. This continuously fails with invalid file format no matter what the path or the image I attempt to load is.
However if I change that above line to:
Bitmap b = new Bitmap(newImage);
IntPtr bitmapPointer = b.GetHbitmap();
GCHandle handle1 = GCHandle.Alloc(b.Palette);
IntPtr palettePointer = (IntPtr)handle1;
this.result = PDFXC_Funcs.PXC_AddImageFromHBITMAP(newPDFObject, bitmapPointer, palettePointer, out imageOut);
It all of a sudden works. The path is the exact same, nothing at all has changed other than I am adding the image from HBITMAP instead of a filepath. Clearly I am doing something wrong as I've seen other posts from people claiming this works.
I understand the solution/issue may not be evident from the above alone, but what other information can I provide? I am confused as to why all other surrounding code is the exact same but changing it to load from a windows bitmap instead of a file path works.
Problem loading images
Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan
- Tracker Supp-Stefan
- Site Admin
- Posts: 17889
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
Re: Problem loading images
Hello DolphinMann,
Do you have the fm40*.dll dlls included in your project?
Those are the ones responsible for the image formats in question:
Redistribution of PDF-XChange Libraries
Regards,
Stefan
Do you have the fm40*.dll dlls included in your project?
Those are the ones responsible for the image formats in question:
Redistribution of PDF-XChange Libraries
Regards,
Stefan
-
- User
- Posts: 158
- Joined: Mon Aug 04, 2014 7:34 pm
Re: Problem loading images
I almost certainly do not and I think I missed that entire section of documentation you linked.
Thank you for the response. Let me take a look at that and post my results.
-Mark
Thank you for the response. Let me take a look at that and post my results.
-Mark
- Will - Tracker Supp
- Site Admin
- Posts: 6815
- Joined: Mon Oct 15, 2012 9:21 pm
- Location: London, UK
- Contact:
Re: Problem loading images
Let us know how it goes
If posting files to this forum, you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded.
Thank you.
Best regards
Will Travaglini
Tracker Support (Europe)
Tracker Software Products Ltd.
http://www.tracker-software.com
Thank you.
Best regards
Will Travaglini
Tracker Support (Europe)
Tracker Software Products Ltd.
http://www.tracker-software.com
-
- User
- Posts: 158
- Joined: Mon Aug 04, 2014 7:34 pm
Re: Problem loading images
That fixed everything for me. Thank you.
- Will - Tracker Supp
- Site Admin
- Posts: 6815
- Joined: Mon Oct 15, 2012 9:21 pm
- Location: London, UK
- Contact:
Re: Problem loading images
If posting files to this forum, you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded.
Thank you.
Best regards
Will Travaglini
Tracker Support (Europe)
Tracker Software Products Ltd.
http://www.tracker-software.com
Thank you.
Best regards
Will Travaglini
Tracker Support (Europe)
Tracker Software Products Ltd.
http://www.tracker-software.com