PDFsharp & MigraDoc Foundation https://forum.pdfsharp.net/ |
|
Windows 7 and converting jpg images to PDF https://forum.pdfsharp.net/viewtopic.php?f=3&t=1185 |
Page 1 of 1 |
Author: | marco.facchetti [ Fri May 14, 2010 7:56 am ] | ||
Post subject: | Windows 7 and converting jpg images to PDF | ||
I using PDF Sharp library to convert JPG list file into pdf file. Using pdfsharp library on windows 7 o.s. the result it's horrible. If I use TIFF tif the conversion is correct. I using 1.31.1789.0 versione into vs.2005 My source code it's that. Any idea ? Public Shared Sub ImagesToPDF(ByVal imagePath As List(Of String), ByVal pdfPath As String) Dim PdfDoc As PdfSharp.Pdf.PdfDocument = Nothing Dim Xgr As PdfSharp.Drawing.XGraphics = Nothing Dim Img As PdfSharp.Drawing.XImage = Nothing Try PdfDoc = New PdfSharp.Pdf.PdfDocument For Each f As String In imagePath PdfDoc.Pages.Add(New PdfSharp.Pdf.PdfPage) Dim PageIndex As Integer = PdfDoc.Pages.Count - 1 Xgr = PdfSharp.Drawing.XGraphics.FromPdfPage(PdfDoc.Pages(PageIndex)) Img = PdfSharp.Drawing.XImage.FromFile(f) If PdfDoc.Pages(PageIndex).Width.Point < Img.Size.Width Then PdfDoc.Pages(PageIndex).Width = XUnit.FromPoint(Img.Size.Width) End If If PdfDoc.Pages(PageIndex).Height.Point < Img.Size.Height Then PdfDoc.Pages(PageIndex).Height = XUnit.FromPoint(Img.Size.Height) End If Xgr.DrawImage(Img, 0, 0, Img.Size.Width, Img.Size.Height) Img.Dispose() Xgr.Dispose() Next PdfDoc.Save(pdfPath) PdfDoc.Close() PdfDoc.Dispose() Catch ex As Exception Throw New ApplicationException("Errore nel metodo " & System.Reflection.MethodInfo.GetCurrentMethod.Name & ".", ex) End Try End Sub
|
Author: | marco.facchetti [ Fri May 14, 2010 12:15 pm ] |
Post subject: | Re: Windows 7 and converting jpg images to PDF |
Also I test my procedure on windows server 2008 and the conversion from jpg to PDF it's ok. Any idea ? Marco |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |