The Best iText Questions on StackOverflow
The Best iText Questions on StackOverflow
About the Book
Since 2013, StackOverflow is the most important channel used by iText Software to answer questions about iText from developers who do not have access to Premium support. Many of these questions are answered by iText's original developer, Bruno Lowagie. Once Bruno noticed that he had answered more than 1,000 questions (resulting in a 20K+ reputation), he decided to bundle the most frequently asked, most useful and most interesting questions into a book.
The result is a book with answers to questions about PDF in general, high-level iText objects, low-level functionality, fonts, forms, page events, tables, HTML, and much more. If you have a question about iText, check out this book. If the question has been asked before, you may find the answer in this book.
This book is available for free. Just register on LeanPub and indicate that you want to purchase the book for $0. Make sure you leave your e-mail address, because this is a book that will be updated on a regular basis. More specifically: every time a series of new, interesting questions have been added. By registering for this book, you'll get a short mail informing you that you can download an updated version.
- Why StackOverflow?
- How to use this book?
Questions about PDF in general
- What is the difference between iText, JasperReports and Adobe LC?
- Does a PDF file have styles, headers and footers?
- How to extract a page number from a PDF file?
- How to disable the save button and hide the menu bar in Adobe Reader?
- How to close a PDF file to recreate it? (File in use problem)
- How to hide the Adobe floating toolbar when showing a PDF in browser?
- Why are PDF files different even if the content is the same?
- Why do PDFs change when processing them?
- How to find out if a PDF file compressed or not?
- How to protect a PDF with a username and password?
- How to encrypt PDF using a certificate?
- How to protect an already existing PDF with a password?
- How to allow page extraction when setting password security?
- How do I rotate a PDF page to an arbitrary angle?
- What is the size limit of pdf file?
- Can I change the page count by changing internal metadata?
- How to get the page number of an arbitrary PDF object?
- Where is the origin (x,y) of a PDF page?
- How should I interpret the coordinates of a rectangle in PDF?
- How to generate and design PDFs with iText or iTextSharp?
- Argument not specified in iTextSharp
- How to create a complex PDF document?
- How to align two paragraphs to the left and right on the same line?
- How to align a label versus its content?
- how to match the size of graphics with the size of a page?
- How to set the page size to Envelope size with Landscape orientation?
- How to use the full size of a page?
- How to create a document with unequal page sizes?
- How to change the line spacing of text?
- Does anyone have any idea how TabStop works?
- How to strike through text using iText?
- How to underline text with a dotted line?
- How to add a full line break?
- How to create a custom dashed line separator?
- How can I generate a PDF/UA compatible PDF with iText?
How to use the font Verdana in
- Why doesn’t FontFactory.GetFont() work for all fonts?
- Why aren’t my fonts getting registered?
- How to use Cyrillic characters in a PDF?
- Why is iText embedding a font even when I specify not to embed?
- How to identify a single font that can print all the characters in a string?
How to change the font color and size when using
- How to create Persian content in PDF?
How to solve an
UnsupportedCharsetExceptionwhen using itext-asian.jar?
- How to choose the optimal size for a font?
- How to restrict the number of characters on a single line?
- How to calculate the height of an element?
- How to calculate/set font line distance?
Why can’t I set the font of a
How to use two different colors in a single
How to apply color to
Strings in a
- How to introduce a custom font weight?
- How to make a single letter bold within a word?
- How to introduce superscript?
How to allow a Unicode subscript symbol in a PDF without using
- How to display indian rupee symbol?
- Why isn’t the Rupee symbol showing?
- How to use System Font in iTextSharp with VB.net?
- Do I need a license for Windows fonts when using iText?
- How to get a font from an array?
- How to use the font Verdana in
- How to add multiple images into a single PDF?
- How to get the image DPI in PDF?
- Why aren’t images added sequentially?
- How to add text to an image?
- How to draw lines on an image?
- How to preserve high resolution images in PDF?
- How to add JPEG images that are multi-stage filtered (DCTDecode and FlateDecode)?
- How to avoid an exception when importing a TIFF file?
- How to show an image with large dimensions across multiple pages?
- How to give an image rounded corners?
- How to convert colored images to black And white?
- How to make an image a qualified mask candidate in itext?
How to create unique images with
- How to generate 2D barcode as vector image?
- How to change a background Image into a watermark by altering the opacity?
Absolute positioning of text
- How to write a Zapfdingbats character at a specific location on a page?
- How to reduce redundant code when adding content at absolute positions?
- How to truncate text within a bounding box?
- How to continue an ordered list on a second page?
ColumnTextignore the horizontal alignment?
How to fit a
Stringinside a rectangle?
Why does using
ColumnTextresult in “The document has no pages” exception?
- How to divide a page in N parts so we can fill each with a different source?
- How to rotate a single line of text?
- How to rotate a paragraph?
- How to draw a rectangle around multiline text?
- What is causing syntax errors in a page created with iText?
- How to adapt the position of the first line in ColumnText?
Absolute positioning of lines and shapes
- How to add a border to a PDF page?
- How to create a PDF with a Cartesian grid?
- Why does the cell background color affect the color of other lines?
- How do I set parameters back to the default value?
- How to add a shading pattern to a custom shape?
How to right-align text in a
- How to use multiple fonts in a single cell?
- How to change width of single column of table?
- How to introduce a rowspan?
- How to maintain a paragraph’s indentation inside a table cell?
What is the
PdfPTable.DefaultCellproperty used for?
- How to draw a borderless table in iTextSharp?
.setBorder(PdfPCell.NO_BORDER)have any effect?
How to define spacing and leading in
- How can I convert a CSV file to a table with a repeating header row?
- How to create a table based on a two-dimensional array?
- How to nest tables without extending the inner table?
- How to add an inner table surrounded by text?
How to resize an
Imageto fit it into a
- How to display barcodes in a matrix-like structure?
- How to split a row over multiple pages?
How does a
PdfPCell’s height relate to the font size?
- How to add a table to the bottom of the last page?
- How do setMinimumSize() and setFixedSize() interact?
- How to get the rendered dimensions of text?
- How to tell iText how to clip text to fit in a cell?
How to resize a
PdfPTableto fit the page?
- What’s an easy to print “first right, then down”?
- How to invoke a page break for nested tables?
- How to make a footer stick to bottom of every pdf page?
- How to add continue on next page / continued from next page to a table?
- How to right-align text in a
- How to use a dotted line as a cell border?
- How to create a table with rounded corners?
- How to introduce rounded cells with a background color?
- How to set background image in PdfPCell in iText?
- How to get text and image in the same cell?
- Is it possible to attach multiple layout events to a PdfPCell?
How to precisely position an image on top of a
- Why is my cell event not triggered?
- How to add text as a header or footer?
- How to add a rectangle to every page of a document?
- How can I add an image to all pages of my PDF?
- How to set a fixed background image for all my pages?
Why do I get a
How to introduce multiple
- How to check for an event and remove it?
- How to add a text to the left and to the right in a header?
- How to add a table as a header?
- How to create a table with 2 rows that can be used as a footer?
- How to generate a report with dynamic header in PDF using itextsharp?
- How to add a page number in the header of a PDF/A Level A file?
- How to rotate a page while creating a PDF document?
- How to draw a line every 25 words?
- How to add a border to a paragraph?
- How to change the color of pages?
Parsing XML and XHTML
- Why is it so difficult to convert XML to PDF?
- How to adjust the page height to the content height?
- How to set line spacing when using XML Worker?
- How to add external CSS while generating PDF?
- How to do HTML to XML conversion to generate closed tags?
- How to make a particular sub-string Bold when converting HTML to PDF?
- How to parse multiple HTML files into a single PDF
- How to add a rich Textbox (HTML) to a table cell?
- How to get particular html table contents to write it in PDF?
- Why doesn’t CSS and RowSpan work?
- Why is XMLWorker parsing slow?
- How to export Vietnamese text to PDF using iText?
- Certain HTML entities (arrows) are not rendered in PDF
- How to set RTL direction for Hebrew when converting HTML to PDF?
- How to convert Arabic HTML to PDF?
Inspect a PDF with iText
Why do I get an “
InvalidPdfException: PDF header signature not found”?
- How to Get PDF page width and height?
- Why is the page size of a PDF always the same, no matter if it’s landscape or portrait?
- How to get the UserUnit from a PDF file?
- How can I read Roman page numbers?
- How do I get an object if I have its indirect reference?
- How to read PDFs created with an unknown random owner password?
- How to get values from comment annotations?
- How can I find the border color of a field?
- How to read bookmark titles?
- How to read bookmarks?
- How To find internal links in a PDF file?
- How to extract embedded streams?
- Why do I get an “
Manipulating existing PDFs
- How to update a PDF without creating a new PDF?
- How to add an image watermark to a PDF file?
- How to add a watermark to a page with an opaque image?
- How to watermark PDFs using text or images?
- How to extend the page size of a PDF to add a watermark?
PdfStampercreate a file with 0 bytes?
- How to add blank pages to an existing PDF in java?
- Adding blank pages while concatenating several PDFs in iText using PdfSmartCopy
- How to position text relative to page?
- How can I crop the pages of an existing PDF document?
- How to rotate a page 90 degrees?
- How to crop out a part of PDF file?
- How to rotate and scale pages in an existing PDF?
- How to shrink pages in an existing PDF?
- How to fix the orientation of a PDF page in order to scale it?
- How to reuse a page from one PDF document into another PDF document?
- How to merge documents correctly?
- How to add a cover page to an existing PDF document?
- Why does the function to concatenate / merge PDFs cause issues in some cases?
How to merge PDFs from
- How to merge PDFs and add bookmarks?
- How to create a TOC when merging documents?
- How to reorder pages in an existing PDF file?
- How to reorder the pages of a PDF file?
- How to set the OCG state of an existing PDF?
- How to change the order of Optional Content Groups?
- How to create a PDF with font information and embed the actual font while merging the files into a single PDF?
- How to decrypt a PDF document with the owner password?
- How do I add XMP metadata to each page of an existing PDF?
- How to move the content inside a rectangle inside an existing PDF?
- How to load a PDF from a stream and add a file attachment?
- How to fill out a pdf file programmatically? (AcroForm technology)
- How to fill out a pdf file programmatically? (Dynamic XFA)
- Is it safe to remove XFA?
- How to flatten a XFA PDF Form using iTextSharp?
- How to tell iText which fields to flatten first?
- How to merge forms from different files into one PDF?
- How to save an .xfdf file as a .pdf file?
- How to edit a PDF embedded in the browser and save the PDF directly to server?
- How to send a ‘success’ response back to Acrobat Reader from a java servlet?
- Why do I get an error saying that “use of extended features is no longer available”?
- How to fill XFA form using iText without breaking usage rights?
- How to deal with missing characters in the default font of a text field?
- How to make sure a check box is printed?
- How to check a check box?
- How to distribute the radio buttons of a radio field across multiple PdfPCells?
- How to find out which fields are required?
- How to make a field not required?
- How to get the number of characters in a field?
- How to align AcroFields?
- How to change the text color of an AcroForm field?
- How to get the color properties of an AcroForm field?
- How to find the absolute position and dimension of a field?
- How to move an AcroForm field?
- How to continue field output on a second page?
- How to add a table on a form (and maybe insert a new page)?
- How to add an image to an AcroForm field?
- How to format a field as a percentage?
- How to add a hidden text field?
- How to send a file to the server through a PDF?
- How to add a text field to an existing pdf template
- How can I add a new AcroForm field to a PDF?
- How to underline a portion of text in a text field?
- Why are the AcroFields in my document empty?
- How to create a pushbuttonfield with double byte character text?
- How to define the data encoding when submitting a PDF form using AcroForm technology?
Actions and annotations
- How to create hierarchical bookmarks?
- How can I add titles of chapters in ColumnText?
- How to create a link to a specific page number?
- How to insert a “linked rectangle” with iText?
- How to add a maps with a pointer to a PDF?
- How to create a clickable polygon or path?
- How do I insert a hyperlink to another page with iTextSharp in an existing PDF?
- How to add a printable or non-printable bitmap stamp to a PDF?
- How to create a pop-up a window to display images and text?
- How to stamp image on existing PDF and create an anchor?
- How to set the BaseUrl of an existing PDF document?
- How to set zoom level to pdf using iTextSharp?
- How to change the properties of an annotation?
- How to create a link to launch an external program?
- How to attach files to a PDF?
- How to delete attachments in PDF using iText?
- How to define multiple actions for a PushbuttonField?
- How to add an “In Reply To” annotation?
- How to get the author of a “free text” annotation?
- How to change the author name for comments?
- How to change the color of a circle annotation?
Extracting text from PDFs
- How to remove text from a PDF?
- How to create and apply redactions?
- What are the extra characters in the font name of my PDF?
- How to extract text and anchor information from a PDF?
- How to read text from a specific position?
- How to use a text extraction strategy after applying a location extraction strategy?
- Why can’t I extract text added using a Type3 font correctly from a PDF?
- How to get the co-ordinates of an image?
- How to check if a font is bold?
- Why is the text I extract from an English PDF page garbled?
General questions about iText
- Unit Testing and Automated Testing Questions
- How to set initial view properties?
Why do I get a “Could not find
- Why can’t I compile the iText source code?
Why do I get a BouncyCastle
- How to change the spacing between words and characters?
- How to add / delete / retrieve information from a PDF using a custom property?
- How to create an uncompressed PDF file?
- How to detect if PDF has compressed xref table in Java?
- How to increase the accuracy of measurements in iTextSharp?
- How to prevent the resizing of pages in PDF?
- How to hyphenate text?
- How to get the current page count?
- When is the content flushed to a PDF File by itextsharp?
How to convert
PdfStamperto a byte array?
- How to create a new PDF file if a file name already exists?
- How can I serve a PDF to a browser without storing a file on the server side?
Why do I get a “
getOutputStream()has already been called for this response” error in JSP?
- What is the difference between Lowagie and iText?
- Can iText 2.1.7 or earlier be used commercially?
- Can I use iText without respecting the AGPL license?
- Is iText Java library free of charge or are there any fees to be paid?
- Can I bundle iText with my non-commercial software?
- When does Bruno Lowagie act like “kind of a dick”?
- To be continued…
The Leanpub 45-day 100% Happiness Guarantee
Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers), EPUB (for phones and tablets) and MOBI (for Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learning Drupal 9 as a frameworkStef Van Looveren
This course will teach you advanced concepts of drupal 9, Object-oriented PHP and Symfony components. After the course, you’ll be able to build robust and scalable software solutions of many kinds.
Continuous Delivery PipelinesDave Farley
This practical handbook provides a step-by-step guide for you to get the best continuous delivery pipeline for your software.
Practical FP in Scala: A hands-on approachGabriel Volpe
A practical book aimed for those familiar with functional programming in Scala who are yet not confident about architecting an application from scratch.
Together, we will develop a purely functional application using the best libraries in the Cats ecosystem, while learning about design patterns and best practices.
Ansible for DevOpsJeff Geerling
Ansible is a simple, but powerful, server and configuration management tool. Learn to use Ansible effectively, whether you manage one server—or thousands.
C++20 is the next big C++ standard after C++11. As C++11 did it, C++20 changes the way we program modern C++. This change is, in particular, due to the big four of C++20: ranges, coroutines, concepts, and modules.
Introducing EventStormingAlberto Brandolini
The deepest tutorial and explanation about EventStorming, straight from the inventor.
Advanced Web Application ArchitectureMatthias Noback
The missing manual for making your web applications future-proof
Deep Learning with PyTorch Step-by-StepDaniel Voigt Godoy
In 2019, I published a PyTorch tutorial on Towards Data Science and I was amazed by the reaction from the readers! Their feedback motivated me to write this book to help beginners start their journey into Deep Learning and PyTorch. I hope you enjoy reading this book as much as I enjoy writing it.
Visualise, document and explore your software architectureSimon Brown
A short guide to visualising, documenting and exploring your software architecture.
R Programming for Data ScienceRoger D. Peng
This book brings the fundamentals of R programming to you, using the same material developed as part of the industry-leading Johns Hopkins Data Science Specialization. The skills taught in this book will lay the foundation for you to begin your journey learning data science. Printed copies of this book are available through Lulu.
C++ Best PracticesJason Turner
Level up your C++, get the tools working for you, eliminate common problems, and move on to more exciting things!
Functional Design and ArchitectureAlexander Granin
Software Design in Functional Programming, Design Patterns and Practices, Methodologies and Application Architectures. How to build real software in Haskell with less efforts and low risks. The first complete source of knowledge.
The Hundred-Page Machine Learning BookAndriy Burkov
Everything you really need to know in Machine Learning in a hundred pages.
CCIE SP v5.0Łukasz Bromirski, Piotr Jablonski, and Nicholas Russo
Are you striving to prepare to and pass CCIE SP lab exam? Take the opportunity and get this workbook! With the attached initial cfg files you will prepare yourself for the CCIE SP exam as well as learn SP technologies applicable to all kinds of today modern networks! This workbook covers blueprint topics and provides challenging examples.
Technical leadership and the balance with agilitySimon Brown
A developer-friendly, practical and pragmatic guide to lightweight software architecture, technical leadership and the balance with agility.
The Simple Haskell HandbookMarco Sampellegrini
A project-driven approach to practical Haskell development. Start from zero lines of code and finish with a working CI Server. Step by step. One type error at a time.
Atomic KotlinBruce Eckel and Svetlana Isakova
For both beginning and experienced programmers! From the author of the multi-award-winning Thinking in C++ and Thinking in Java and a Kotlin team member comes a book that breaks concepts into small, easy-to-digest "atoms," along with exercises supported by hints and solutions directly inside IntelliJ IDEA! Full support at www.AtomicKotlin.com.
Everyday Rails - RSpecによるRailsテスト入門Junichi Ito (伊藤淳一), AKIMOTO Toshiharu, 魚振江, and Aaron Sumner
RSpecを使ってRailsアプリケーションに信頼性の高いテストを書く実践的なアドバイスを提供します。詳細で丁寧な説明は本書のオリジナルコンテンツです。また、説明には実際に動かせるサンプルアプリケーションも使用します。本書は2017年版にアップデートされ、RSpec 3.6やRails 5.1といった新しい環境に対応しています！さあ、自信をもってテストできるようになりましょう！
Rector - The Power of Automated RefactoringMatthias Noback and Tomas Votruba
Learn how to automatically and continuously upgrade and improve your PHP code base
Ansible for KubernetesJeff Geerling
Ansible is a powerful infrastructure automation tool. Kubernetes is a powerful application deployment platform. Learn how to use these tools to automate massively-scalable, highly-available infrastructure.
Software Architecture for Developers: Volumes 1 & 2 - Technical leadership and communication
2 Books"Software Architecture for Developers" is a practical and pragmatic guide to modern, lightweight software architecture, specifically aimed at developers. You'll learn:The essence of software architecture.Why the software architecture role should include coding, coaching and collaboration.The things that you really need to think about before...#1
Software Architecture for Developers: Volumes 1 & 2 - Technical leadership and communication
2 Books"Software Architecture for Developers" is a practical and pragmatic guide to modern, lightweight software architecture, specifically aimed at developers. You'll learn:The essence of software architecture.Why the software architecture role should include coding, coaching and collaboration.The things that you really need to think about before...
CCIE Service Provider Ultimate Study Bundle
2 BooksPiotr Jablonski, Lukasz Bromirski, and Nick Russo have joined forces to deliver the only CCIE Service Provider training resource you'll ever need. This bundle contains a detailed and challenging collection of workbook labs, plus an extensively detailed technical reference guide. All of us have earned the CCIE Service Provider certification...#2
CCIE Service Provider Ultimate Study Bundle
2 BooksPiotr Jablonski, Lukasz Bromirski, and Nick Russo have joined forces to deliver the only CCIE Service Provider training resource you'll ever need. This bundle contains a detailed and challenging collection of workbook labs, plus an extensively detailed technical reference guide. All of us have earned the CCIE Service Provider certification...
9 BooksThis bundle enables readers to buy all 9 eBooks in:1. TOCLG series (Get the concept well)2. TOCDIY series (Learn how to implement) and3. eTOC series of eBooks (Learn from various TOC Gurus).
Cisco CCNA 200-301 Complet
4 BooksCe lot comprend les quatre volumes du guide préparation à l'examen de certification Cisco CCNA 200-301.
4 BooksLearn to master Python with this bundle. Be part of the #onemillion2021 project where one million people get trained on Cloud Computing, Data and Python globally by 2021.
"The C++ Standard Library" and "Concurrency with Modern C++"
2 BooksGet my books "The C++ Standard Library" and "Concurrency with Modern C++" in a bundle. The first book gives you the details you should know about the C++ standard library; the second one dives deeper into concurrency with modern C++. In sum, you get more than 600 pages full of modern C++ and about 250 source files presenting the standard library...#9
"The C++ Standard Library" and "Concurrency with Modern C++"
2 BooksGet my books "The C++ Standard Library" and "Concurrency with Modern C++" in a bundle. The first book gives you the details you should know about the C++ standard library; the second one dives deeper into concurrency with modern C++. In sum, you get more than 600 pages full of modern C++ and about 250 source files presenting the standard library...
EA for Programmers
2 BooksFor those who want to get most of Enterprise Architects API and bejond, this bundle offers an unbeatable resource. While Scripting EA introduces the API step by step, Inside EA will dive even deeper into EA's database structure. Knowing this will let you do things that are not available through the API. Or simply you can boost the performance...#10
EA for Programmers
2 BooksFor those who want to get most of Enterprise Architects API and bejond, this bundle offers an unbeatable resource. While Scripting EA introduces the API step by step, Inside EA will dive even deeper into EA's database structure. Knowing this will let you do things that are not available through the API. Or simply you can boost the performance...