Page 1 of 1

Windows Server 2003 vs XP. PDF to JPG

Posted: Tue Mar 06, 2012 6:35 pm
by DaveHarris
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

Re: Windows Server 2003 vs XP. PDF to JPG

Posted: Tue Mar 06, 2012 6:48 pm
by Loïc
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

Re: Windows Server 2003 vs XP. PDF to JPG

Posted: Wed Mar 07, 2012 11:28 am
by DaveHarris
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

Re: Windows Server 2003 vs XP. PDF to JPG

Posted: Wed Mar 07, 2012 11:33 am
by Loïc
Hello,

Code: Select all

gdPictureImaging.ConvertTo1Bpp(imageID, 220);
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

Re: Windows Server 2003 vs XP. PDF to JPG

Posted: Wed Mar 07, 2012 12:52 pm
by DaveHarris
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

Re: Windows Server 2003 vs XP. PDF to JPG

Posted: Thu Mar 08, 2012 11:45 am
by DaveHarris
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

Re: Windows Server 2003 vs XP. PDF to JPG

Posted: Thu Mar 08, 2012 4:21 pm
by Loïc
Hello Dave,

Thank you very much for the return.

Yes you have a memory issue with your large PDF documents:

Code: Select all

RenderPageToGdPictureImageEx(72f, true);
2 solutions (as you probably already understood): allow your asp process to allocate more memory, or decrease the rendering resolution.

Cheers!

Loïc