Look at the PDF language that Acrobat created and that iText created and see
what's different.
From: Viktor Shlayer [mailto:[email protected]]
Sent: Thursday, December 02, 2010 5:35 PM
To: [email protected]
Subject: [iText-questions] Open package attachment in new window
Hello,
I'm making packages with
stamper.MakePackage(itext.PdfName.T);
Before that I'm adding a few previously created PDF documents with
stamper.AddFileAttachment("Doc", null,
HttpContext.Current.Server.MapPath(myPDFPath), myPDFName);
Finally in a package I'll have something like:
MyPDF1.pdf
MyPDF2.pdf
MyTXT.txt
...
I need to create bookmark in MyPDF1.pdf that will open MyPDF2.pdf attached to
the package in new window on the first page.
I'm trying to do this next way:
itext.PdfDestination dest = new
iTextSharp.text.pdf.PdfDestination(iTextSharp.text.pdf.PdfDestination.XYZ,-1,0,0);
itextCollection.PdfTargetDictionary tc = new
itextCollection.PdfTargetDictionary(false);
tc.EmbeddedFileName = "MyPDF2.pdf";
itext.PdfAction gtr =
itext.PdfAction.GotoEmbedded("MyPDF2.pdf", tc, dest, true);
itext.PdfOutline outl = new
iTextSharp.text.pdf.PdfOutline(writer.DirectContent.RootOutline, gtr, "test");
writer.DirectContent.RootOutline.AddKid(outl);
//I was trying also writer.DirectContent.AddOutline(outl, "zzz");, but it
throws exception. As I understood from code - it works with local destination
only
In final PDF I have a bookmark which is not working. I know that it is possible
to do things like that (I successfuly created bookmark like I need in Acrobat),
but can not understand how that could be done with iTextSharp.
Right now my algorithm is next: I'm making documents MyPDF1.pdf, MyPDF2.pdf and
trying to create a bookmark in MyPDF1. Then I'm saving those files and later
creating package using MakePackage like it is described above.
I've spent a lot of time trying to figure out how this could be done but still
can not find what I'm doing wrong. Unfortunately I'm working with iText from
time to time and have no clear vision of how it works. I hope somebody will
help me to find a solution for my problem. Thanks.
P.S.: Actually I'm working with iTextSharp, but iTextSharp mailing list is
closed and I see no choice except send my problem to this mailing list.
With regards
Viktor
------------------------------------------------------------------------------
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