Text position problem when inserting text to PDF. 2006-08-10 - By Paulo Soares
Back The media box doesn't start at 0,0. There's nothing wrong with it but you must adjust the position.
Paulo
-- -- Original Message -- -- From: "SeungHyun Park" <enzen.dark@(protected)> To: <itext-questions@(protected)> Sent: Thursday, August 10, 2006 7:46 AM Subject: [iText-questions] Text position problem when inserting text to PDF.
> Hello. > > > > I have used iText to handle existing PDF files. > > > > I have developed a program to insert text to existing PDF files. > > > > My program works very well while I have inserted text to many PDF. > > > > > > > > But, I face strange problem. > > > > I found a PDF file where text cannot be inserted. Actually text may be > inserted to outside of page. > > > > When I debug it, my code is correct and iText extracts correct page size > but > the text is inserted to wrong position that is different for me to assign. > > > > > > I wrote test code and it is as the following; (I use iTextsharp 3.1.0.0 > and > 3.1.3.0.) > > ============================================================ > > Private Sub Test1() > Dim SourceFileName As String = Environment.CurrentDirectory & > "\test.pdf" > Dim OutputFileName As String = Environment.CurrentDirectory & > "\test_output.pdf" > > > FontFactory.RegisterDirectories() > > Dim reader As New PdfReader(SourceFileName) > Dim Stamp As New PdfStamper(reader, New FileStream(OutputFileName, > FileMode.Create)) > > Dim oFont As Font = FontFactory.GetFont("Gulim", > BaseFont.IDENTITY_H, > True, 30) > > Dim oLayer As PdfContentByte = Stamp.GetOverContent(1) > > oLayer.BeginText() > > oLayer.SetFontAndSize(oFont.BaseFont, 30) > > oLayer.ShowTextAligned(PdfContentByte.ALIGN_LEFT, "Test Text", 10, > 10, 0) > > oLayer.EndText() > > Stamp.Close() > reader.Close() > > End Sub > > ============================================================= > > It works well with many PDF files but it does not with the special PDF > file. > > > > I cannot see the text when I assign the position to (10, 10) but I can see > it when I assign (10, 1000) at above code. but its position is not to > want to > insert. > > > > > > Its producer string is Adobe Acrobat 7.0AC PDFScanib v 1.2.2 and its > version is PDF 1.6. > > It may be created by Acrobat 7 and scanner. > > > > > > Finally I attach the strange PDF file for your testing. > > > > > > > > > > If you could take a few minutes to answer my questions, I would really > appreciate it. > > > > > > > > Best regards, > > > > S. H. Park >
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
> -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
> __ ____ ____ ____ ____ ____ ____ ____ ____ ____ > iText-questions mailing list > iText-questions@(protected) > https://lists.sourceforge.net/lists/listinfo/itext-questions >
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 __ ____ ____ ____ ____ ____ ____ ____ ____ ____ iText-questions mailing list iText-questions@(protected) https://lists.sourceforge.net/lists/listinfo/itext-questions
|
|