Windows Server 2003 vs XP. PDF to JPG
-
- Posts: 4
- Joined: Tue Mar 06, 2012 5:41 pm
Windows Server 2003 vs XP. PDF to JPG
Hi,
We are creating JPGs from PDFs using the following sequence of calls:
_______________________________________________________________________
const int drawingsWidthMax = 748;
GdPicture.GdPicturePDF gdPicturePDF = new GdPicture.GdPicturePDF();
GdPicture.GdPictureStatus status = gdPicturePDF.LoadFromFile(pdfPath, false);
if (!gdPicturePDF.SelectPage(1)) { ... error ... }
GdPicture.GdPictureImaging gdPictureImaging = new GdPicture.GdPictureImaging();
int imageID = gdPicturePDF.RenderPageToGdPictureImageEx(72f, true);
if (imageID == 0) { ... error ... }
int height = gdPictureImaging.GetHeight(imageID);
int width = gdPictureImaging.GetWidth(imageID);
gdPictureImaging.SetROI(0, 0, width, height);
gdPictureImaging.ConvertTo1Bpp(imageID, 220);
int jpgID = gdPictureImaging.CreateThumbnailHQ(imageID, drawingsWidthMax, drawingsWidthMax * height / width);
status = gdPictureImaging.SaveAsJPEG(jpgID, pathWithoutExtension + ".jpg", 75);
if (status != GdPicture.GdPictureStatus.OK) { ... error ... }
______________________________________________________________________
The attached PDF creates a good image when using XP machine under Visual Studio 10 web server, however 'a white' JPG is created using Windows Server 2003 (both 32-bit and up to date in service packs).
Is there difference between Windows Server 2003 and XP?
(we are currently running GdPicture.NET SDK version 8.5.17, .NET 3.5. it also fails with an earlier 8.5 version)
Regards Dave
We are creating JPGs from PDFs using the following sequence of calls:
_______________________________________________________________________
const int drawingsWidthMax = 748;
GdPicture.GdPicturePDF gdPicturePDF = new GdPicture.GdPicturePDF();
GdPicture.GdPictureStatus status = gdPicturePDF.LoadFromFile(pdfPath, false);
if (!gdPicturePDF.SelectPage(1)) { ... error ... }
GdPicture.GdPictureImaging gdPictureImaging = new GdPicture.GdPictureImaging();
int imageID = gdPicturePDF.RenderPageToGdPictureImageEx(72f, true);
if (imageID == 0) { ... error ... }
int height = gdPictureImaging.GetHeight(imageID);
int width = gdPictureImaging.GetWidth(imageID);
gdPictureImaging.SetROI(0, 0, width, height);
gdPictureImaging.ConvertTo1Bpp(imageID, 220);
int jpgID = gdPictureImaging.CreateThumbnailHQ(imageID, drawingsWidthMax, drawingsWidthMax * height / width);
status = gdPictureImaging.SaveAsJPEG(jpgID, pathWithoutExtension + ".jpg", 75);
if (status != GdPicture.GdPictureStatus.OK) { ... error ... }
______________________________________________________________________
The attached PDF creates a good image when using XP machine under Visual Studio 10 web server, however 'a white' JPG is created using Windows Server 2003 (both 32-bit and up to date in service packs).
Is there difference between Windows Server 2003 and XP?
(we are currently running GdPicture.NET SDK version 8.5.17, .NET 3.5. it also fails with an earlier 8.5 version)
Regards Dave
- Attachments
-
- TEST.zip
- Test Docs
- (597.29 KiB) Downloaded 384 times
-
- 8738.2.zip
- example PDF causing the issue
- (333.1 KiB) Downloaded 375 times
Last edited by DaveHarris on Wed Mar 07, 2012 12:53 pm, edited 2 times in total.
Re: Windows Server 2003 vs XP. PDF to JPG
Hello Dave,
There is no attached PDF. You can zip it or send it through https://www.gdpicture.com/support/getting-support-from-our-team
Maybe you are running in an out of memory state. Also, you should check the retuned values of all GdPicture methods to get some information about the error.
Kind regards,
Loïc
There is no attached PDF. You can zip it or send it through https://www.gdpicture.com/support/getting-support-from-our-team
Maybe you are running in an out of memory state. Also, you should check the retuned values of all GdPicture methods to get some information about the error.
Kind regards,
Loïc
-
- Posts: 4
- Joined: Tue Mar 06, 2012 5:41 pm
Re: Windows Server 2003 vs XP. PDF to JPG
Hi Loic, thanks for the quick reply.
There are no errors being returned and there is no evidence of out-of-memory on the server.
I have also corrected my first post. A white/black JPG is created (I previously posted that it created no JPG)
Kind regards
There are no errors being returned and there is no evidence of out-of-memory on the server.
I have also corrected my first post. A white/black JPG is created (I previously posted that it created no JPG)
Kind regards
Re: Windows Server 2003 vs XP. PDF to JPG
Hello,
The threshold value is too high. You should try to comment this line, or decrease the value to 120 for example or use adaptive threshold.
Let me know if the problem persists.
Kind regards,
Loïc
Code: Select all
gdPictureImaging.ConvertTo1Bpp(imageID, 220);
Let me know if the problem persists.
Kind regards,
Loïc
-
- Posts: 4
- Joined: Tue Mar 06, 2012 5:41 pm
Re: Windows Server 2003 vs XP. PDF to JPG
Hi
Thanks, we tried thresholds from 0 to 254 - always white image. Tried adaptive threshold - same.
I will pass you two more PDFs (Test 1.4 and Test 1.6). Test 1.4 works perfectly (the PDF is version 1.4), Test 1.6 is the equivalent PDF saved as version 1.6, this causes the white JPG. This seems to indicate there maybe some problems handling version 1.6 pdfs, and in particular with Windows Server 2003?
Thanks, kind regards
Thanks, we tried thresholds from 0 to 254 - always white image. Tried adaptive threshold - same.
I will pass you two more PDFs (Test 1.4 and Test 1.6). Test 1.4 works perfectly (the PDF is version 1.4), Test 1.6 is the equivalent PDF saved as version 1.6, this causes the white JPG. This seems to indicate there maybe some problems handling version 1.6 pdfs, and in particular with Windows Server 2003?
Thanks, kind regards
-
- Posts: 4
- Joined: Tue Mar 06, 2012 5:41 pm
Re: Windows Server 2003 vs XP. PDF to JPG
Hi Loic, just wanted to say thanks for your help on this we have managed to resolve the issue. We think we were exhausting memory in the ASP.NET process when we processed very large pdfs.
Regards Dave
Regards Dave
Re: Windows Server 2003 vs XP. PDF to JPG
Hello Dave,
Thank you very much for the return.
Yes you have a memory issue with your large PDF documents:
2 solutions (as you probably already understood): allow your asp process to allocate more memory, or decrease the rendering resolution.
Cheers!
Loïc
Thank you very much for the return.
Yes you have a memory issue with your large PDF documents:
Code: Select all
RenderPageToGdPictureImageEx(72f, true);
Cheers!
Loïc
Who is online
Users browsing this forum: No registered users and 2 guests