PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

ximage FromGdiPlusImage issue on Windows Server 2008 R2
https://forum.pdfsharp.net/viewtopic.php?f=2&t=1779
Page 1 of 1

Author:  sebdeluxe [ Mon Sep 12, 2011 8:43 am ]
Post subject:  ximage FromGdiPlusImage issue on Windows Server 2008 R2

Hi

I have created a method for creating PDF files out of tiff files.
the method works perfectly on Windows Server 2003 and 2008 std. also x86 and x64.
The I tried running the application on a Windows Server 2008 x64 R2 and suddenly the PDF file only contained the first page of the multitiff file.

scenario is: 10 page multitiff file converted into a 10 page PDF file.
but when running the application on Windows Server 2008 R2 x64 the same first page on the multitiff file was on all 10 pages of the PDF file... why?

my code:

Dim oImg As System.Drawing.Image = Nothing
oImg = New Bitmap(oInputMemStream)

...

For _imgPageCount = 1 To _imgPageCountTotal

oImg.SelectActiveFrame(oImgFrameDimension, _imgPageCount - 1)
Dim newImg As System.Drawing.Image = oImg

'Testing to see if the correct page has been choosen and everthing so far works fine
newImg.Save("D:\" & _imgPageCount & ".tif", System.Drawing.Imaging.ImageFormat.Tiff)

oPDFPage = New PdfPage
oPDFPage.Size = PageSize.A4
oPDFPage.Orientation = PageOrientation.Portrait
oPDFDoc.Pages.Add(oPDFPage)

'adding the image/bitmap to the PDF ximage
oPDFImg = XImage.FromGdiPlusImage(newImg)
oPDFGraphic = XGraphics.FromPdfPage(oPDFPage)
oPDFGraphic.DrawImage(oPDFImg, 0, 0, CType(oPDFImg.PointWidth, Integer), CType(oPDFImg.PointHeight, Integer))

next

...

oPDFDoc.Save(oPDFMemStream, False)


any one has an idea why this is working on some system and not on others???

Br, Sebastian Johannsson

Author:  sebdeluxe [ Thu Sep 15, 2011 9:42 am ]
Post subject:  Re: ximage FromGdiPlusImage issue on Windows Server 2008 R2

Found the solution....

PDFSharp /ximage was not the problem, but instead the .NET FrameDimensions when creating Multitiff files.
apparently Windows 2008 x64, 2003 etc does not have any issues if the frameDimension is not correct set.
windows server 2008 x64 R2 has an issued with that and after correcting this everything works perfectly again :D

Br, Sebastian

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/