# PDF Parser and Reading API

**URL:** <https://discourse.julialang.org/t/pdf-parser-and-reading-api/4797>\
**Category:** Data\
**Created:** [July 12, 2017, 8:34am UTC](https://discourse.julialang.org/t/pdf-parser-and-reading-api/4797 "2017-07-12T08:34:54Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![sambitdash](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sambitdash/32/1377_2.png) [@sambitdash](https://discourse.julialang.org/u/sambitdash)\
**Post date:** [April 1, 2019, 3:18pm UTC](https://discourse.julialang.org/t/pdf-parser-and-reading-api/4797/21 "2019-04-01T15:18:43Z")

</div>

I just checked in the fix. Please go ahead take the latest. There are certain assumptions that were missed out in the implementation of the PDFIO. If it’s ok with you me adding the file to the test case, will love to do so. Sometimes, PDF creators tend to use the PDF spec in ways that stretches to the limits.

Ignore the build breaks as they are due to a download repository, that’s no longer accessible. I am looking at possibilities of uploading the files to the repository if the original hosting site has no objection.

---

<div class="post-metadata">

**Author:** ![Nosferican](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nosferican/32/9275_2.png) [@Nosferican](https://discourse.julialang.org/u/Nosferican)\
**Post date:** [April 1, 2019, 6:43pm UTC](https://discourse.julialang.org/t/pdf-parser-and-reading-api/4797/22 "2019-04-01T18:43:01Z")

</div>

Worked like a charm! Feel free to use the pdf. It is produced by the PR state senate so it is public domain. Thanks!

---

<div class="post-metadata">

**Author:** ![sambitdash](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sambitdash/32/1377_2.png) [@sambitdash](https://discourse.julialang.org/u/sambitdash)\
**Post date:** [April 23, 2019, 10:06am UTC](https://discourse.julialang.org/t/pdf-parser-and-reading-api/4797/23 "2019-04-23T10:06:14Z")

</div>

Release 0.1.3

1. Documentation updated to the current and can be automatically updated with every release.
2. `pdDocGetOutline` method added to get access to the document bookmarks (PDF terminology outline).  
a. `PDOutline` and `PDOutlineItem` provide access structures to traverse the outlines. You can use the `AbstractTrees` module interfaces to traverse these structures.  
b. `pdOutlineItemGetAttrs` enables you to query the `PDOutlineItems` to get the details.
3. Page number related APIs:  
a. `pdPageGetPageNumber` - gets the physical page number for the current page.  
b. `pdDocGetPageLabel` - gets the logical page label given an absolute page number.
4. Fonts related methods:  
a. `pdFontIsBold`, `pdFontIsItalic`, `pdFontIsFixedW`, `pdFontIsAllCap`, `pdFontIsSmallCap` - provide the font attributes of the font. However, bold attribute of a font is just an estimate as in PDF, bold can be simulated by changing font weights, by over printing, Hence, the attribute may not be very accurate.

---

<div class="post-metadata">

**Author:** ![chakravala](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chakravala/32/6832_2.png) [@chakravala](https://discourse.julialang.org/u/chakravala)\
**Post date:** [April 23, 2019, 10:22am UTC](https://discourse.julialang.org/t/pdf-parser-and-reading-api/4797/24 "2019-04-23T10:22:04Z")

</div>

Would be great if DjVu docs with optical character recognition were supported.

The `djvulibre` library has a tool for converting the djvu docs to text called `djvutxt`.

---

<div class="post-metadata">

**Author:** ![sambitdash](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sambitdash/32/1377_2.png) [@sambitdash](https://discourse.julialang.org/u/sambitdash)\
**Post date:** [April 23, 2019, 10:47am UTC](https://discourse.julialang.org/t/pdf-parser-and-reading-api/4797/25 "2019-04-23T10:47:39Z")

</div>

`djvulibre` or any library which is GPL licensed is not compatible to the MIT licensing of PDFIO. So unfortunately, we cannot integrate it with PDFIO.

---

<div class="post-metadata">

**Author:** ![o314](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/o314/32/252_2.png) [@o314](https://discourse.julialang.org/u/o314)\
**Post date:** [May 10, 2019, 12:17am UTC](https://discourse.julialang.org/t/pdf-parser-and-reading-api/4797/26 "2019-05-10T00:17:45Z")

</div>

If you want to OCR some stuff, [Tesseract](https://opensource.google.com/projects/tesseract), license apache, by HP, Google may be the way to go.  
It was ported in js by mit folk there [https://tesseract.projectnaptha.com](https://tesseract.projectnaptha.com)

[Tabula](http://tabula.technology/), license mit, [Camelot](https://github.com/socialcopsdev/camelot/), license mit, are great projects to ocr table too.

_EDIT: add link to camelot_

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [May 10, 2019, 2:49am UTC](https://discourse.julialang.org/t/pdf-parser-and-reading-api/4797/27 "2019-05-10T02:49:32Z")

</div>

> [@sambitdash](#):
>
> `djvulibre` or any library which is GPL licensed is not compatible to the MIT licensing of PDFIO. So unfortunately, we cannot integrate it with PDFIO.

The [GPL is compatible](https://www.gnu.org/licenses/license-list.en.html#Expat) with the MIT (aka expat/X11) license, it’s just that the _combined_ work falls under the GPL.

---

<div class="post-metadata">

**Author:** ![sambitdash](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sambitdash/32/1377_2.png) [@sambitdash](https://discourse.julialang.org/u/sambitdash)\
**Post date:** [May 10, 2019, 5:26am UTC](https://discourse.julialang.org/t/pdf-parser-and-reading-api/4797/28 "2019-05-10T05:26:01Z")

</div>

We have no intention of changing the license of PDFIO to GPL at this time.

---

<div class="post-metadata">

**Author:** ![sambitdash](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sambitdash/32/1377_2.png) [@sambitdash](https://discourse.julialang.org/u/sambitdash)\
**Post date:** [June 21, 2019, 11:55am UTC](https://discourse.julialang.org/t/pdf-parser-and-reading-api/4797/29 "2019-06-21T11:55:35Z")

</div>

[v0.1.4 - Release Notes](https://github.com/sambitdash/PDFIO.jl/releases/tag/v0.1.4)

[Edit](https://github.com/sambitdash/PDFIO.jl/releases/edit/v0.1.4)

[![@julia-tagbot](https://global.discourse-cdn.com/julialang/original/3X/5/a/5a97fd93b81e7397c71935bb497b31805cee8d03.png)](https://github.com/apps/julia-tagbot) [julia-tagbot](https://github.com/apps/julia-tagbot) released this 4 days ago

## [v0.1.4](https://github.com/sambitdash/PDFIO.jl/tree/v0.1.4) (2019-06-17)

This release has the following enhancements:

1. Support for validation of Digital Signatures in a PDF document.
2. Performance improvement of `pdPageExtractText` .

---

<div class="post-metadata">

**Author:** ![sambitdash](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sambitdash/32/1377_2.png) [@sambitdash](https://discourse.julialang.org/u/sambitdash)\
**Post date:** [June 26, 2019, 5:11pm UTC](https://discourse.julialang.org/t/pdf-parser-and-reading-api/4797/30 "2019-06-26T17:11:15Z")

</div>

[v0.1.5 - Documentation Update](https://github.com/sambitdash/PDFIO.jl/releases/tag/v0.1.5)

[Edit](https://github.com/sambitdash/PDFIO.jl/releases/edit/v0.1.5)

[![@julia-tagbot](https://global.discourse-cdn.com/julialang/original/3X/5/a/5a97fd93b81e7397c71935bb497b31805cee8d03.png)](https://github.com/apps/julia-tagbot) [julia-tagbot](https://github.com/apps/julia-tagbot) released this 3 days ago

Documentation has been significantly updated and sample code is added to most methods.

---

<div class="post-metadata">

**Author:** ![sambitdash](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sambitdash/32/1377_2.png) [@sambitdash](https://discourse.julialang.org/u/sambitdash)\
**Post date:** [July 9, 2019, 11:02pm UTC](https://discourse.julialang.org/t/pdf-parser-and-reading-api/4797/31 "2019-07-09T23:02:21Z")

</div>

[v0.1.6 - Support for password protected PDF files](https://github.com/sambitdash/PDFIO.jl/releases/tag/v0.1.6)

[![@julia-tagbot](https://global.discourse-cdn.com/julialang/original/3X/5/a/5a97fd93b81e7397c71935bb497b31805cee8d03.png)](https://github.com/apps/julia-tagbot) [julia-tagbot](https://github.com/apps/julia-tagbot) released this 3 minutes ago

## [v0.1.6](https://github.com/sambitdash/PDFIO.jl/tree/v0.1.6) (2019-07-09)

[Diff since v0.1.5](https://github.com/sambitdash/PDFIO.jl/compare/v0.1.5...v0.1.6)

**Merged pull requests:**

- Support for encrypted PDF files with standard crypto handler ([#67](https://github.com/sambitdash/PDFIO.jl/pull/67)) ([sambitdash](https://github.com/sambitdash))

---

<div class="post-metadata">

**Author:** ![sambitdash](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sambitdash/32/1377_2.png) [@sambitdash](https://discourse.julialang.org/u/sambitdash)\
**Post date:** [July 14, 2019, 5:42pm UTC](https://discourse.julialang.org/t/pdf-parser-and-reading-api/4797/32 "2019-07-14T17:42:45Z")

</div>

Hi All,

With certificate based encrypted files handled now almost all PDF file types can be read by the APIs as long as you have the required access passwords or recipient certificates. Kind of inclined to call this the 1.0 version, once any stability issues are reported and handled.

regards,

Sambit

[v0.1.7](https://github.com/sambitdash/PDFIO.jl/releases/tag/v0.1.7)

[![@julia-tagbot](https://global.discourse-cdn.com/julialang/original/3X/5/a/5a97fd93b81e7397c71935bb497b31805cee8d03.png)](https://github.com/apps/julia-tagbot) [julia-tagbot](https://github.com/apps/julia-tagbot) released this 3 hours ago

## [v0.1.7](https://github.com/sambitdash/PDFIO.jl/tree/v0.1.7) (2019-07-12)

[Diff since v0.1.6](https://github.com/sambitdash/PDFIO.jl/compare/v0.1.6...v0.1.7)

**Merged pull requests:**

- PKI Security Handler implementation ([#69](https://github.com/sambitdash/PDFIO.jl/pull/69)) ([sambitdash](https://github.com/sambitdash))

Assets2

[Source code(zip)](https://github.com/sambitdash/PDFIO.jl/archive/v0.1.7.zip)

[Source code(tar.gz)](https://github.com/sambitdash/PDFIO.jl/archive/v0.1.7.tar.gz)

---

<div class="post-metadata">

**Author:** ![hasanOryx](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hasanoryx/32/5373_2.png) [@hasanOryx](https://discourse.julialang.org/u/hasanOryx)\
**Post date:** [September 7, 2019, 6:53pm UTC](https://discourse.julialang.org/t/pdf-parser-and-reading-api/4797/33 "2019-09-07T18:53:17Z")

</div>

Well done, just used it, appreciate your efforts and time 😘

---

<div class="post-metadata">

**Author:** ![eatbot](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/eatbot/32/10581_2.png) [@eatbot](https://discourse.julialang.org/u/eatbot)\
**Post date:** [October 2, 2019, 6:27am UTC](https://discourse.julialang.org/t/pdf-parser-and-reading-api/4797/34 "2019-10-02T06:27:34Z")

</div>

Hi Sambitdash,  
I am looking for a stable and scaleable solution to read/parse complex PDF and present it in json or strucutred database.

How can I use your solution? Please check eat.bot for what I’m trying to do. Thanks

---

<div class="post-metadata">

**Author:** ![sambitdash](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sambitdash/32/1377_2.png) [@sambitdash](https://discourse.julialang.org/u/sambitdash)\
**Post date:** [October 2, 2019, 7:21am UTC](https://discourse.julialang.org/t/pdf-parser-and-reading-api/4797/35 "2019-10-02T07:21:50Z")

</div>

Hi @eatbot,

PDFIO is a PDF reading library. It can read a PDF file and present it in terms of low level PDF objects. It’s no machine learning library to understand internal representation of text or image artifacts. You can pick up the low level PDF objects and extract the PDF elements that are useful to you.

Complexity of PDF documents is purely creator introduced. A complex PDF document with a good quality creator can be made absolutely well tagged representation like an XML. So with the information you have shared it’s absolutely hard to decipher what you are looking for.

While extracting text is one of the things PDFIO implements in enough details, you will need to understand the PDF specification well to be able to do any significant PDF extraction tasks. Again representation of PDF to JSON is depends on your data model and how you will need the representation for your consumption. Once, you have the object hierarchy you should be able to convert to any hierarchical format of your choice including JSON.

regards,

Sambit

---

<div class="post-metadata">

**Author:** ![sambitdash](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sambitdash/32/1377_2.png) [@sambitdash](https://discourse.julialang.org/u/sambitdash)\
**Post date:** [October 6, 2019, 8:28am UTC](https://discourse.julialang.org/t/pdf-parser-and-reading-api/4797/36 "2019-10-06T08:28:33Z")

</div>

Hi All,

I am planning to move to Julia 1.3 for PDFIO to include the pre-built packages under the JuliaBinaryWrappers which to me seems like a very consistent experience with binary packages. However, if you are using any older PDFIO packages the last version will be 0.1.7 which supports Julia 1.1.

If you have concerns moving to Julia 1.3 please let me know.

[https://github.com/sambitdash/PDFIO.jl/issues/73](https://github.com/sambitdash/PDFIO.jl/issues/73)

regards,

Sambit

---

<div class="post-metadata">

**Author:** ![sambitdash](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sambitdash/32/1377_2.png) [@sambitdash](https://discourse.julialang.org/u/sambitdash)\
**Post date:** [November 3, 2019, 7:14pm UTC](https://discourse.julialang.org/t/pdf-parser-and-reading-api/4797/37 "2019-11-03T19:14:33Z")

</div>

The changes are already in place at: [https://github.com/sambitdash/PDFIO.jl/pull/75](https://github.com/sambitdash/PDFIO.jl/pull/75)

It’ll be merged when Julia 1.3.0 is generally available. There is a bug in the RC build due to 7z, which has been addressed and may be released as part of the GA build.

regards,

Sambit

---

<div class="post-metadata">

**Author:** ![sambitdash](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sambitdash/32/1377_2.png) [@sambitdash](https://discourse.julialang.org/u/sambitdash)\
**Post date:** [November 15, 2019, 7:54am UTC](https://discourse.julialang.org/t/pdf-parser-and-reading-api/4797/38 "2019-11-15T07:54:29Z")

</div>

The PDFIO is now published as part of the Journal of Open Source Software.

> **[PDFIO: PDF Reader Library for native Julia](https://joss.theoj.org/papers/10.21105/joss.01453)**
>
> Dash, (2019). PDFIO: PDF Reader Library for native Julia. Journal of Open Source Software, 4(43), 1453, https://doi.org/10.21105/joss.01453

regards,

Sambit

---

<div class="post-metadata">

**Author:** ![ludwig-austermann](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ludwig-austermann/32/11093_2.png) [@ludwig-austermann](https://discourse.julialang.org/u/ludwig-austermann)\
**Post date:** [November 15, 2019, 11:47am UTC](https://discourse.julialang.org/t/pdf-parser-and-reading-api/4797/39 "2019-11-15T11:47:45Z")

</div>

Hey @sambitdash,

I recently wanted to port my python pdf tool to julia. It requires to merge, split, rotate etc. pdfs, but especially to insert blank pages inside a pdf.

Are such operations supported by PDFIO and if so, in which way?

Thanks, ludwig

---

<div class="post-metadata">

**Author:** ![sambitdash](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sambitdash/32/1377_2.png) [@sambitdash](https://discourse.julialang.org/u/sambitdash)\
**Post date:** [November 15, 2019, 12:01pm UTC](https://discourse.julialang.org/t/pdf-parser-and-reading-api/4797/40 "2019-11-15T12:01:42Z")

</div>

Hi @ludwig-austermann,

`PDFIO` is a Reader API. There is no writer functionality.

It has a full PDF specification object model. So extending the PDF writing functionality will not be difficult but understanding of a good bit of PDF specification may be needed.

If you want to extend it please go ahead and submit PR, I will be happy to support as a package owner.

regards,

Sambit

[Previous page](https://discourse.julialang.org/t/pdf-parser-and-reading-api/4797.md?page=1)

[Next page](https://discourse.julialang.org/t/pdf-parser-and-reading-api/4797.md?page=3)
