After a week of work, today's project finally came to an end. Although it was completed by two masters rather than their own strength, they learned a lot, first of all in PDF file format. I read a PDF file every day. It's all in English. I spent all my eyes on it, but I didn't find anything on the Internet. It's all about reprinting, repeat the several articles and read the PDF instructions for countless times.
So I decided to take a look at it by myself. I really understood it and simply said what I learned.
PDF files have several types of objects, bool integer real-number OBJ dictionary stream null
They constitute PDF files
Let's give an example.
Because the PDF file is opened in notepad, let's talk about the main part of the file.
A PDF file is first a header that represents version number. % PDF-1.4
Followed by various objects
Then there is a cross-index table used to read each object. They can know the exact location of each object.
Finally, trailer tells us the object on which the main root of the file is and the specific location of the cross-index table, so that the root object can be found based on the Cross-index table, the object tells us the location of pages outline, and we will find every page until we find the page.
For example, we can find the root
43 0 OBJ
</Metadata 103 0 r/terraform 99 0 r/pages 39 0 r/type/CATALOG> endobj
Traverse pages at 39 0
Today's project profile has not found the problem, but later I found the problem through the tracking and feeling of experts.
A class is inherited from a vector. The constructor calls assign, but the function that defines this type of object reads the object. In other words, it calls a lot, therefore, the Construction and Analysis of objects are too scary. By defining global objects, the construction of objects is reduced, and the efficiency is improved by half. although the global object is quite annoying, you can consider static for a global test.
We also find that the real software development is not the hundred lines we think.CodeWhen I gave a small module of the project to me, I looked at the dozens of classes and found that to optimize so many codes, I really needed patience and perseverance,