"Lots of antiquated corporate requirements" would be my guess.  "Nothing
gets installed on our computers until its blessed by IT" + "IT has been
grossly underfunded for years" = "outdated software installations".
 
--Mark Storer
  Senior Software Engineer
  Cardiff.com
 
import legalese.Disclaimer;
Disclaimer<Cardiff> DisCard = null;
 
 


________________________________

        From: Leonard Rosenthol [mailto:[email protected]] 
        Sent: Saturday, November 20, 2010 4:56 PM
        To: [email protected]
        Subject: Re: [iText-questions] Issue with opening Pdf in Acrobat
7
        
        

        Given that Reader 7 is no longer supported by Adobe, and that
the upgrade to Reader X (the current version) is FREE - why do you care?

         

        From: karsep5 [mailto:[email protected]] 
        Sent: Friday, November 19, 2010 6:57 PM
        To: [email protected]
        Subject: [iText-questions] Issue with opening Pdf in Acrobat 7

         

        The following piece of code is supposed to take an existing pdf
and add a bubble with a text in it. It works correctly when opening in
Adode Reader 8 and 9. But in Reader 7, it throws "Error while parsing a
Form, Type 3 font, or Pattern". The code in bold is causing the issue
but i dont know how to fix it. using System; using
System.Collections.Generic; using System.Linq; using System.Text; using
iTextSharp.text.pdf; using iTextSharp.text; using System.IO; namespace
ITextPdfCheck { class Program { private static Image
_GetBubbleImage(PdfContentByte cb, Font font, string label, float
bubbleX, float bubbleY) { PdfTemplate boxTemplate =
cb.CreateTemplate(bubbleX, bubbleY); boxTemplate.SetLineWidth(1);
boxTemplate.Ellipse(1, 1, bubbleX - 1, bubbleY - 1); if
(!String.IsNullOrEmpty(label)) { boxTemplate.BeginText();
boxTemplate.SetTextRise(bubbleX / 5.0F);
boxTemplate.SetTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_STROKE)
; boxTemplate.SetFontAndSize(font.BaseFont, 8); float textWidth =
boxTemplate.GetEffectiveStringWidth(label, false);
boxTemplate.MoveText((bubbleX - textWidth) / 2, 0);
boxTemplate.ShowText(label); boxTemplate.EndText();
boxTemplate.Stroke(); } else { boxTemplate.Fill(); } return
Image.GetInstance(boxTemplate); } internal static PdfPCell
CreateBubblePdfCell(PdfContentByte contentByte, string cellContent,
string tagName, float bubbleX, float bubbleY, Font font, int border) {
Image bubbleImage = _GetBubbleImage(contentByte, font, cellContent,
bubbleX, bubbleY); Chunk imageChunk = new Chunk(bubbleImage, 0, 0); if
(!String.IsNullOrEmpty(tagName)) { imageChunk.SetGenericTag(tagName); }
PdfPCell bubbleCell = new PdfPCell(new Phrase(imageChunk)) { Border =
border, Padding = 0, BackgroundColor = BaseColor.WHITE,
HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment =
Element.ALIGN_TOP }; return bubbleCell; } private static PdfTemplate
_GetBubbleTemplate(Font _Font, PdfContentByte cb, string label, int
bubbleX, int bubbleY, string tagName) { PdfTemplate pdfTemplate =
cb.CreateTemplate(bubbleX + 2, bubbleY + 2); PdfPTable pdfPTable = new
PdfPTable(1); pdfPTable.SetTotalWidth(new float[] { bubbleX }); PdfPCell
pdfPCell = CreateBubblePdfCell(cb, label, tagName, bubbleX, bubbleY,
_Font, 0); pdfPTable.AddCell(pdfPCell); pdfPTable.WriteSelectedRows(0,
-1, 0, pdfPTable.TotalHeight, pdfTemplate); return pdfTemplate; } static
void Main(string[] args) { Document document = new Document(); Font
_Font = FontFactory.GetFont(FontFactory.HELVETICA); try { using
(MemoryStream localMemoryStream = new MemoryStream()) { PdfReader
pdfReader = new PdfReader(File.ReadAllBytes(@"test.pdf")); PdfWriter
pdfWriter = PdfWriter.GetInstance(document, localMemoryStream);
document.Open(); PdfImportedPage pdfImportedPage =
pdfWriter.GetImportedPage(pdfReader, 1); PdfContentByte cb =
pdfWriter.DirectContent; cb.AddTemplate(pdfImportedPage, 0, 0);
cb.AddTemplate(_GetBubbleTemplate(_Font, cb, "A", 20, 20, ""), 101,
101); pdfReader.Close(); document.Close();
File.WriteAllBytes(@"test1.pdf", localMemoryStream.GetBuffer()); } }
catch (Exception ex) { Console.WriteLine(ex); } document.Close(); } } } 

________________________________

        View this message in context: Issue with opening Pdf in Acrobat
7
<http://itext-general.2136553.n4.nabble.com/Issue-with-opening-Pdf-in-Ac
robat-7-tp3051169p3051169.html> 
        Sent from the iText - General mailing list archive
<http://itext-general.2136553.n4.nabble.com/>  at Nabble.com.

------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

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

Reply via email to