Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, August 11, 2010 10:52:35 AM(UTC)
Sebastian

Groups: Registered
Posts: 2


Hi,
We are using your product, and we are having a strange issue with the PDF conversion.
I’m trying to load a pdf and convert it to an image, but I have a problem.

If I load the pdf from a disk path, I have no problem, like this:
RasterImage image = codecsLibrary.codecs.Load(@"C:\PdfFile.pdf", 0, CodecsLoadByteOrder.Rgb, 1, -1);
It loads the total pages ok and the text/Images for each page.

But when I load the pdf from an Uri like this:
RasterImage image = codecsLibrary.codecs.Load(new Uri("http://antbase.org/ants/publications/20994/20994.pdf ", UriKind.Absolute), 0, CodecsLoadByteOrder.Rgb, 1, -1);
It only loads 1 blank/empty page and nothing else.
And if I do this to read the second page:
RasterImage image = codecsLibrary.codecs.Load(new Uri("http://antbase.org/ants/publications/20994/20994.pdf ", UriKind.Absolute), 0, CodecsLoadByteOrder.Rgb, 2, 2);
I have a RasterException: “PDF Error – File is corrupted”
 
I don’t know why this is happening, like I said, if I load the pdf from a disk path, works fine, but with an Uri I have this problem. I need to mention that we could get other things like Images from Uri without any problems.

Could this be related to the HTTP request?
Could this be related to the codecsLibrary Options that we are missing to add something?

Information of my Environment:

- LeadTools 17
- Visual Studio 2010
- Windows Server 2008R2
- Framework 4.0

Any help would be appreciated.

Thanks,
Sebastian
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Thursday, August 12, 2010 2:36:58 AM(UTC)

Adam Boulad  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

Sebastian,
Using RasterCodecs.Load(Uri..) does not work with all file formats (such as PDF). If you want to load PDF files you can either:
1- Use .NET methods and functions to save the file to temporary disk location and then use our RasterCodecs.Load(String...) method to load it.
2- Use .NET methods and functions to retrieve the PDF file into a MemoryStream and then use RasterCodecs.Load(Stream...) to load it.
 
#3 Posted : Thursday, August 12, 2010 11:31:46 AM(UTC)
Sebastian

Groups: Registered
Posts: 2


Hi Adam,
I loaded the PDF into a MemoryStream and it works as expected.

Thanks for your help! [:)]

Regards,
Sebastian
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.053 seconds.