Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-page pdf pushing content #119

Open
Pritoj opened this issue Nov 7, 2016 · 1 comment
Open

Multi-page pdf pushing content #119

Pritoj opened this issue Nov 7, 2016 · 1 comment

Comments

@Pritoj
Copy link

Pritoj commented Nov 7, 2016

I'm trying to create a simple service where I get a pdf file.

I need to add a header to every page. The header has a fixed size. So I want the content to be paginated accordingly.

So if I have an unmodified PDF file

Page 1 : 
------------------------
|                       |
| Old pdf content       |
| More content          |
| Even more content     |
------------------------
Page 2 : 
------------------------
|                       |
| Old pdf content       |
| More content          |
| Even more content     |
------------------------

The new PDF should look like this...

Page 1 : 
------------------------
| Header Content-1      |
| Header Content-2      |
|                       |
| Old pdf content-1     |
------------------------
Page 2 : 
------------------------
| Header Content-1      |
| Header Content-2      |
| More content-1        |
| Even more content-1   |
------------------------
Page 3 : 
------------------------
| Header Content-1      |
| Header Content-2      |
|                       |
| Old pdf Content-2     |
------------------------
Page 4 : 
------------------------
| Header Content-1      |
| Header Content-2      |
| More content-2        |
| Even more content-2   |
------------------------

Is there a way to do this?

@can-keklik
Copy link

can-keklik commented Nov 7, 2016

If you are asking that there is an option in API for this kind of operation, I guess not.

But if you want to crop pages manually,

It depends on definition of your content. Cases are:

Full text: You need to break text, I think it would be difficult (Not sure is it possible or not)
Full image: Doesn't contain any text, fully image. Well then you should crop images, easier than text case.
Mixed: Text makes it difficult, again.

I think, even if cropping your content is _possible, It won't be _feasible.

An alternative to cropping is faking. I mean you wrap your pages with XObjects, and then put XObject-wrapped pages into new pages. First copy to page 1, second goes to 2, .... Of course with different y coordinates. If you really need to do this operation, you should try faking.

But If I were you, I would try to resize pages, not to break them. Just shrink page, and put your headers, footers, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants