Comments (5)
Thanks for trying lopdf, which example are you using, the one in readme file?
You can upload your PDF to https://paste.rs/
curl --data-binary @file.txt https://paste.rs/
BTW, field_init_shorthand will be available in Rust 1.17.
from lopdf.
I'm sorry, GitHub didn't want me to attach files. The file is available at: https://paste.rs/ztf
I created a new project, copy-pasted the code from the README, hit cargo run. This is the result:
%PDF-1.5
1 0 obj<</Type/Pages/Kids[5 0 R]/Count 1/Resources 3 0 R/MediaBox[0 0 595 842]>>endobj
2 0 obj<</Type/Font/Subtype/Type1/BaseFont/Courier>>endobj
3 0 obj<</Font<</F1 2 0 R>>>>endobj
4 0 obj<</Length 45>>stream
BT
/F1 48 Tf
100 600 Td
(Hello World!) Tj
ET
endstream endobj
5 0 obj<</Type/Page/Parent 1 0 R/Contents[4 0 R]>>endobj
xref
0 6
0000000000 65535 f
0000000009 00000 n
0000000096 00000 n
0000000155 00000 n
0000000191 00000 n
0000000281 00000 n
trailer
<</Root<</Type/Catalog/Pages 1 0 R>>/Size 6>>
startxref
338
%%EOF
There are some things that I wanted to note: Usually, a PDF file has several high-bit characters on the second line, like this:
%PDF-1.4
%¥±ë
1 0 obj
It doesn't change anything if I add these characters, though. I also wanted to note that this only appears in the default Linux PDF viewer (I think it is called Risetto). pdftk even crashes on this file and Chrome does not want to display it either.
There is certainly something wrong with it, however it displays fine in Adobe Reader.
from lopdf.
Just for reference, here is a very similar PDF that is displaying well on all browsers / PDF viewers:
%PDF-1.1
%¥±ë
1 0 obj
<< /Type /Catalog
/Pages 2 0 R
>>
endobj
2 0 obj
<< /Type /Pages
/Kids [3 0 R]
/Count 1
/MediaBox [0 0 300 144]
>>
endobj
3 0 obj
<< /Type /Page
/Parent 2 0 R
/Resources
<< /Font
<< /F1
<< /Type /Font
/Subtype /Type1
/BaseFont /Times-Roman
>>
>>
>>
/Contents 4 0 R
>>
endobj
4 0 obj
<< /Length 55 >>
stream
BT
/F1 18 Tf
0 0 Td
(Hello World) Tj
ET
endstream
endobj
xref
0 5
0000000000 65535 f
0000000018 00000 n
0000000077 00000 n
0000000178 00000 n
0000000457 00000 n
trailer
<< /Root 1 0 R
/Size 5
>>
startxref
565
%%EOF
see https://brendanzagaeski.appspot.com/0004.html
from lopdf.
zathura can open this file, the reason of other readers is that they don't allow Catalog as an direct object in trailer.
I updated my example code now.
from lopdf.
Yup, seems to work now, thanks for making this library.
from lopdf.
Related Issues (20)
- Insert image and flatten form HOT 1
- [Question] How can I replace an image?
- Some Pdf Parse Outline Failed HOT 2
- Add the merging PDFs together example as a crate function HOT 3
- Crash in `document.extract_text` HOT 2
- Support Korean Font
- How to extract images from a PDF?
- How to read operations correctly? HOT 1
- Is there any more docs or help available? HOT 2
- the `linked-hash-map` crate is in maintenance mode HOT 2
- Unexpected behavior using vowels with acute accent and Arabic text HOT 1
- 如何压缩pdf里面的图片 how to compress pdf images HOT 1
- Release a new version to crates.io HOT 1
- (Suggestion) replace panics with errors HOT 1
- Timeout (100 second) when trying to read and save file HOT 2
- Panic when opening pdf file
- Stack overflow when reading file
- Issue while reading specific pdf files
- `extract_text` inserts newlines where it shouldn't HOT 1
- Deprecate/remove pom_parser in favor of nom_parser HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lopdf.