On Wed, Dec 14, 2011 at 2:20 PM, Hugh McLaughlin <h...@kmcnetwork.com> wrote: > Yeah, it looks like it. So any idea where I'm jumping the track on my Vb.Net > and iTextSharp implementation?
Since this seems to be a problem with a C# => vb.net conversion, send me an attachment with what you have. But please only the part relevant to **this** question. If it's not too long, I can take a look at it. What version of iTextSharp are you running? > -----Original Message----- > From: Keith O [mailto:kuujinbo.mail.l...@googlemail.com] > Sent: Wednesday, December 14, 2011 1:45 AM > To: Post all your questions about iText here > Subject: Re: [iText-questions] Antwort: Re: Converting Fax Tiff to PDF > > On Wed, Dec 14, 2011 at 2:57 AM, Hugh McLaughlin <h...@kmcnetwork.com> wrote: >> Thanks for the response. I tried changing over to Vb.Net which is >> what I am using in this project. However it is still not scaling >> correctly. Attached is the tiff and the resulting pdf. > > Benjamin's code works for me (iTextSharp 5.1.3): > > Image img = Image.GetInstance(imagePath); if (img != null) { // scale if too > big to fit on page > if (img.ScaledWidth > PageSize.A4.Width > || img.ScaledHeight > PageSize.A4.Height > ) > { > // if images have a different resolution (dpi value) for x and y the scaling > considers it > if(img.DpiX != 0 > && img.DpiY != 0 > && img.DpiX != img.DpiY > ) > { > img.ScalePercent(100); > float percentX = (PageSize.A4.Width * 100) / img.ScaledWidth; > float percentY = ( (PageSize.A4.Height * 100) / img.ScaledHeight ); > img.ScalePercent(percentX, percentY); > img.WidthPercentage = 0; > } > else{ > // scaling the image if DPI values for x and y are the same // no customized > scaling i.e. different values for x and y necessary > img.ScaleToFit(PageSize.A4.Width, PageSize.A4.Height); > } > } > document.Add(img); > } > > See attached PDF. > > ------------------------------------------------------------------------------ > Cloud Computing - Latest Buzzword or a Glimpse of the Future? > This paper surveys cloud computing today: What are the benefits? > Why are businesses embracing it? What are its payoffs and pitfalls? > http://www.accelacomm.com/jaw/sdnl/114/51425149/ > _______________________________________________ > iText-questions mailing list > iText-questions@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/itext-questions > > iText(R) is a registered trademark of 1T3XT BVBA. > Many questions posted to this list can (and will) be answered with a > reference to the iText book: http://www.itextpdf.com/book/ > Please check the keywords list before you ask for examples: > http://itextpdf.com/themes/keywords.php ------------------------------------------------------------------------------ Cloud Computing - Latest Buzzword or a Glimpse of the Future? This paper surveys cloud computing today: What are the benefits? Why are businesses embracing it? What are its payoffs and pitfalls? http://www.accelacomm.com/jaw/sdnl/114/51425149/ _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php