Add and edit bookmarks to pdf
By getting metadata from some pdf files with bookmarks by pdftk, I observe the format of bookmarks in pdf metadata. So I am guessing that with pdftk, it is possible to add and edit bookmarks of a pdf file.
Here are three steps that I follow:
- I firstly get the metadata (including bookmarks if any) from a pdf
file into a text file bypdftk in.pdf dump_data > in.info.
Next I add some bookmarks into the metadata text file
in.info, changing it
from
InfoKey: Creator
InfoValue: PScript5.dll Version 5.2
InfoKey: Title
InfoValue: SSReader Print.
InfoKey: Producer
InfoValue: Acrobat Distiller 7.0 (Windows)
InfoKey: Author
InfoValue: Administrator
InfoKey: ModDate
InfoValue: D:20050605073244+08'00'
InfoKey: CreationDate
InfoValue: D:20050605073244+08'00'
PdfID0: 591a87c91dc76881fdf2ccf3811e72a5
PdfID1: 6b6ab11de8824e438e4f5eb1d85ec72
NumberOfPages: 400
PageLabelNewIndex: 1
PageLabelStart: 1
PageLabelNumStyle: DecimalArabicNumerals
to
InfoKey: Creator
InfoValue: PScript5.dll Version 5.2
InfoKey: Title
InfoValue: SSReader Print.
InfoKey: Producer
InfoValue: Acrobat Distiller 7.0 (Windows)
InfoKey: Author
InfoValue: Administrator
InfoKey: ModDate
InfoValue: D:20050605073244+08'00'
InfoKey: CreationDate
InfoValue: D:20050605073244+08'00'
PdfID0: 591a87c91dc76881fdf2ccf3811e72a5
PdfID1: 6b6ab11de8824e438e4f5eb1d85ec72
NumberOfPages: 400
BookmarkBegin
BookmarkTitle: Front cover
BookmarkLevel: 1
BookmarkPageNumber: 1
BookmarkBegin
BookmarkTitle: About the Author
BookmarkLevel: 1
BookmarkPageNumber: 5
BookmarkBegin
BookmarkTitle: Title page
BookmarkLevel: 1
BookmarkPageNumber: 6
BookmarkBegin
BookmarkTitle: Copyright page
BookmarkLevel: 1
BookmarkPageNumber: 7
BookmarkBegin
BookmarkTitle: Foreword
BookmarkLevel: 1
PageLabelNewIndex: 1
PageLabelStart: 1
PageLabelNumStyle: DecimalArabicNumerals
- Then I try to put the edited metadata back to the pdf file by
pdftk.
in.pdf update_info in.info output out.pdf
But when I open the new pdf file out.pdf in evince or adobe reader, there is no bookmark in the new pdf file.
If I get the metadata from the new pdf file out.pdf by pdftk out.pdf dump_data > out.info, there will be no bookmarks in out.info. It looks like the bookmarks were not added successfully.
I was wondering if there are some mistakes? How shall I add and edit bookmarks of a pdf file, not necessarily by pdftk?
pdf pdftk
add a comment |
By getting metadata from some pdf files with bookmarks by pdftk, I observe the format of bookmarks in pdf metadata. So I am guessing that with pdftk, it is possible to add and edit bookmarks of a pdf file.
Here are three steps that I follow:
- I firstly get the metadata (including bookmarks if any) from a pdf
file into a text file bypdftk in.pdf dump_data > in.info.
Next I add some bookmarks into the metadata text file
in.info, changing it
from
InfoKey: Creator
InfoValue: PScript5.dll Version 5.2
InfoKey: Title
InfoValue: SSReader Print.
InfoKey: Producer
InfoValue: Acrobat Distiller 7.0 (Windows)
InfoKey: Author
InfoValue: Administrator
InfoKey: ModDate
InfoValue: D:20050605073244+08'00'
InfoKey: CreationDate
InfoValue: D:20050605073244+08'00'
PdfID0: 591a87c91dc76881fdf2ccf3811e72a5
PdfID1: 6b6ab11de8824e438e4f5eb1d85ec72
NumberOfPages: 400
PageLabelNewIndex: 1
PageLabelStart: 1
PageLabelNumStyle: DecimalArabicNumerals
to
InfoKey: Creator
InfoValue: PScript5.dll Version 5.2
InfoKey: Title
InfoValue: SSReader Print.
InfoKey: Producer
InfoValue: Acrobat Distiller 7.0 (Windows)
InfoKey: Author
InfoValue: Administrator
InfoKey: ModDate
InfoValue: D:20050605073244+08'00'
InfoKey: CreationDate
InfoValue: D:20050605073244+08'00'
PdfID0: 591a87c91dc76881fdf2ccf3811e72a5
PdfID1: 6b6ab11de8824e438e4f5eb1d85ec72
NumberOfPages: 400
BookmarkBegin
BookmarkTitle: Front cover
BookmarkLevel: 1
BookmarkPageNumber: 1
BookmarkBegin
BookmarkTitle: About the Author
BookmarkLevel: 1
BookmarkPageNumber: 5
BookmarkBegin
BookmarkTitle: Title page
BookmarkLevel: 1
BookmarkPageNumber: 6
BookmarkBegin
BookmarkTitle: Copyright page
BookmarkLevel: 1
BookmarkPageNumber: 7
BookmarkBegin
BookmarkTitle: Foreword
BookmarkLevel: 1
PageLabelNewIndex: 1
PageLabelStart: 1
PageLabelNumStyle: DecimalArabicNumerals
- Then I try to put the edited metadata back to the pdf file by
pdftk.
in.pdf update_info in.info output out.pdf
But when I open the new pdf file out.pdf in evince or adobe reader, there is no bookmark in the new pdf file.
If I get the metadata from the new pdf file out.pdf by pdftk out.pdf dump_data > out.info, there will be no bookmarks in out.info. It looks like the bookmarks were not added successfully.
I was wondering if there are some mistakes? How shall I add and edit bookmarks of a pdf file, not necessarily by pdftk?
pdf pdftk
This small graphical tool worked for me. (PDF Mod 0.9.1) apps.fedoraproject.org/packages/pdfmod
– abhijit
Jul 28 '15 at 12:30
add a comment |
By getting metadata from some pdf files with bookmarks by pdftk, I observe the format of bookmarks in pdf metadata. So I am guessing that with pdftk, it is possible to add and edit bookmarks of a pdf file.
Here are three steps that I follow:
- I firstly get the metadata (including bookmarks if any) from a pdf
file into a text file bypdftk in.pdf dump_data > in.info.
Next I add some bookmarks into the metadata text file
in.info, changing it
from
InfoKey: Creator
InfoValue: PScript5.dll Version 5.2
InfoKey: Title
InfoValue: SSReader Print.
InfoKey: Producer
InfoValue: Acrobat Distiller 7.0 (Windows)
InfoKey: Author
InfoValue: Administrator
InfoKey: ModDate
InfoValue: D:20050605073244+08'00'
InfoKey: CreationDate
InfoValue: D:20050605073244+08'00'
PdfID0: 591a87c91dc76881fdf2ccf3811e72a5
PdfID1: 6b6ab11de8824e438e4f5eb1d85ec72
NumberOfPages: 400
PageLabelNewIndex: 1
PageLabelStart: 1
PageLabelNumStyle: DecimalArabicNumerals
to
InfoKey: Creator
InfoValue: PScript5.dll Version 5.2
InfoKey: Title
InfoValue: SSReader Print.
InfoKey: Producer
InfoValue: Acrobat Distiller 7.0 (Windows)
InfoKey: Author
InfoValue: Administrator
InfoKey: ModDate
InfoValue: D:20050605073244+08'00'
InfoKey: CreationDate
InfoValue: D:20050605073244+08'00'
PdfID0: 591a87c91dc76881fdf2ccf3811e72a5
PdfID1: 6b6ab11de8824e438e4f5eb1d85ec72
NumberOfPages: 400
BookmarkBegin
BookmarkTitle: Front cover
BookmarkLevel: 1
BookmarkPageNumber: 1
BookmarkBegin
BookmarkTitle: About the Author
BookmarkLevel: 1
BookmarkPageNumber: 5
BookmarkBegin
BookmarkTitle: Title page
BookmarkLevel: 1
BookmarkPageNumber: 6
BookmarkBegin
BookmarkTitle: Copyright page
BookmarkLevel: 1
BookmarkPageNumber: 7
BookmarkBegin
BookmarkTitle: Foreword
BookmarkLevel: 1
PageLabelNewIndex: 1
PageLabelStart: 1
PageLabelNumStyle: DecimalArabicNumerals
- Then I try to put the edited metadata back to the pdf file by
pdftk.
in.pdf update_info in.info output out.pdf
But when I open the new pdf file out.pdf in evince or adobe reader, there is no bookmark in the new pdf file.
If I get the metadata from the new pdf file out.pdf by pdftk out.pdf dump_data > out.info, there will be no bookmarks in out.info. It looks like the bookmarks were not added successfully.
I was wondering if there are some mistakes? How shall I add and edit bookmarks of a pdf file, not necessarily by pdftk?
pdf pdftk
By getting metadata from some pdf files with bookmarks by pdftk, I observe the format of bookmarks in pdf metadata. So I am guessing that with pdftk, it is possible to add and edit bookmarks of a pdf file.
Here are three steps that I follow:
- I firstly get the metadata (including bookmarks if any) from a pdf
file into a text file bypdftk in.pdf dump_data > in.info.
Next I add some bookmarks into the metadata text file
in.info, changing it
from
InfoKey: Creator
InfoValue: PScript5.dll Version 5.2
InfoKey: Title
InfoValue: SSReader Print.
InfoKey: Producer
InfoValue: Acrobat Distiller 7.0 (Windows)
InfoKey: Author
InfoValue: Administrator
InfoKey: ModDate
InfoValue: D:20050605073244+08'00'
InfoKey: CreationDate
InfoValue: D:20050605073244+08'00'
PdfID0: 591a87c91dc76881fdf2ccf3811e72a5
PdfID1: 6b6ab11de8824e438e4f5eb1d85ec72
NumberOfPages: 400
PageLabelNewIndex: 1
PageLabelStart: 1
PageLabelNumStyle: DecimalArabicNumerals
to
InfoKey: Creator
InfoValue: PScript5.dll Version 5.2
InfoKey: Title
InfoValue: SSReader Print.
InfoKey: Producer
InfoValue: Acrobat Distiller 7.0 (Windows)
InfoKey: Author
InfoValue: Administrator
InfoKey: ModDate
InfoValue: D:20050605073244+08'00'
InfoKey: CreationDate
InfoValue: D:20050605073244+08'00'
PdfID0: 591a87c91dc76881fdf2ccf3811e72a5
PdfID1: 6b6ab11de8824e438e4f5eb1d85ec72
NumberOfPages: 400
BookmarkBegin
BookmarkTitle: Front cover
BookmarkLevel: 1
BookmarkPageNumber: 1
BookmarkBegin
BookmarkTitle: About the Author
BookmarkLevel: 1
BookmarkPageNumber: 5
BookmarkBegin
BookmarkTitle: Title page
BookmarkLevel: 1
BookmarkPageNumber: 6
BookmarkBegin
BookmarkTitle: Copyright page
BookmarkLevel: 1
BookmarkPageNumber: 7
BookmarkBegin
BookmarkTitle: Foreword
BookmarkLevel: 1
PageLabelNewIndex: 1
PageLabelStart: 1
PageLabelNumStyle: DecimalArabicNumerals
- Then I try to put the edited metadata back to the pdf file by
pdftk.
in.pdf update_info in.info output out.pdf
But when I open the new pdf file out.pdf in evince or adobe reader, there is no bookmark in the new pdf file.
If I get the metadata from the new pdf file out.pdf by pdftk out.pdf dump_data > out.info, there will be no bookmarks in out.info. It looks like the bookmarks were not added successfully.
I was wondering if there are some mistakes? How shall I add and edit bookmarks of a pdf file, not necessarily by pdftk?
pdf pdftk
pdf pdftk
edited Dec 28 '16 at 8:25
ice
32
32
asked Jul 20 '11 at 17:26
TimTim
26.5k77253464
26.5k77253464
This small graphical tool worked for me. (PDF Mod 0.9.1) apps.fedoraproject.org/packages/pdfmod
– abhijit
Jul 28 '15 at 12:30
add a comment |
This small graphical tool worked for me. (PDF Mod 0.9.1) apps.fedoraproject.org/packages/pdfmod
– abhijit
Jul 28 '15 at 12:30
This small graphical tool worked for me. (PDF Mod 0.9.1) apps.fedoraproject.org/packages/pdfmod
– abhijit
Jul 28 '15 at 12:30
This small graphical tool worked for me. (PDF Mod 0.9.1) apps.fedoraproject.org/packages/pdfmod
– abhijit
Jul 28 '15 at 12:30
add a comment |
9 Answers
9
active
oldest
votes
It looks to me like from version 1.45 (2012-12-06), pdftk does allow modification of bookmarks via the update_info command:
You can now add or change a PDF’s bookmarks using update_info.
via:
http://www.pdflabs.com/docs/pdftk-version-history/
3
This worked very good for me. One should add that in the input file above theBookmarkBegintags before each bookmark entry are missing.
– danielp
Jul 21 '14 at 20:01
add a comment |
jPDFtweak (Java, so runs on Unix/Linux) can alter bookmarks, but I don't know if you can script anything with it.
For scripting, I'd guess your only native Unix/Linux option would be pdflatex with the pdfpages package. But that's a learning curve if you're not already a LaTeX user.
EDIT: Actually it may be possible with ghostscript: See here or here or
here
add a comment |
If you still stick with those unix scripts, then
- extract bookmark data dumped from
pdftk
- write one extra script to convert dumped bookmark data to pdfmarks format, which ghostscript command
gsis accepted. - use
gsscript to merge them together with pdfmarks
Take a look at http://blog.tremily.us/posts/PDF_bookmarks_with_Ghostscript/ the script pdf-merge.py do exactly what you (or I) want.
pdf-merge.py --output=merged.pdf input1.pdf input2.pdf
Some minor improvements could be done in his script
- unicode handling
- output bookmark files, so people can adjust it as well
Anyway, it should work
One upvote! Thanks! I am looking forward to your script!
– Tim
Feb 7 '12 at 3:14
Seems the link is not working. Can you fix it please?
– Fish Monitor
Jul 22 '13 at 6:42
add a comment |
pdftk is definetly the right tool (with the right syntax):
BookmarkBegin
BookmarkTitle: Chapter 1
BookmarkLevel: 1
BookmarkPageNumber: 1
BookmarkBegin
BookmarkTitle: Paragraph 1.1
BookmarkLevel: 2
BookmarkPageNumber: 1
add a comment |
Caleb,
As far as I understand, bookmarks as per the PDF spec can't be injected via a diagnostic tool like pdftk. Updating the metadata to refer to chapters and bookmark landing anchors that don't exist will definitely not work, it may even make your PDF inconsistent or unopenable.
I ended up using java+iText libraries to do what you're suggesting as per this tutorial, but we're dealing with hundreds of pdfs daily, so it needed to be automated. If you're doing a one-off, Adobe Acrobat should be able to do this.
add a comment |
To summarise all this good answers:
There is bmconverter project on GitHub that can convert various PDF bookmark formats. It can convert pdftk output to jpdftweak format, although if you will use jpdftweak then you wont need to convert pdftk output to csv, as you can do all work from within jpdftweak.
Unfortunately pdfmarks is not supported by the project, but fortunately someone posted script in bmconverter issues that can convert pdftk output to pdfmarks. So ghostscript batch option is an option
add a comment |
pdftk bookmark format is a little bit tedious to write. Instead I created my own script using bash, sed, pdftk and python3. Check it out at this repo: https://github.com/SiddharthPant/booky
So now I can create a text file(bkmrks.txt) like this which takes just 5 minutes to write even for a 1000 page pdf.
{
Title1, 1
Title2, 2
{
Subtitle1, 3
Subtitle2, 4
{
SubSubtitle1, 5
...
}
}
}
and then use my script
./booky.sh pdf_file.pdf bkmrks.txt
this automatically creates a pdf(pdf_file_new.pdf) that has my bookmarks in it.
add a comment |
Just add BookmarkBegin before each bookmark entry, as in
BookmarkBegin
BookmarkTitle: Front cover
BookmarkLevel: 1
BookmarkPageNumber: 1
BookmarkBegin
⋮
add a comment |
The redirect that you used in step 1 will cause update_info to not work correctly. You need to specify the output file to pdftk instead:
pdftk in.pdf dump_data output in.info
See this answer from similar question: https://stackoverflow.com/a/30308964/3158933
Files that I created using a redirect have a slightly larger file size and cause pdftk to issue a "Warning: unexpected case 1 in LoadDataFile(); continuing" message when running the update_info command.
New contributor
cnachtmann is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f17065%2fadd-and-edit-bookmarks-to-pdf%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
9 Answers
9
active
oldest
votes
9 Answers
9
active
oldest
votes
active
oldest
votes
active
oldest
votes
It looks to me like from version 1.45 (2012-12-06), pdftk does allow modification of bookmarks via the update_info command:
You can now add or change a PDF’s bookmarks using update_info.
via:
http://www.pdflabs.com/docs/pdftk-version-history/
3
This worked very good for me. One should add that in the input file above theBookmarkBegintags before each bookmark entry are missing.
– danielp
Jul 21 '14 at 20:01
add a comment |
It looks to me like from version 1.45 (2012-12-06), pdftk does allow modification of bookmarks via the update_info command:
You can now add or change a PDF’s bookmarks using update_info.
via:
http://www.pdflabs.com/docs/pdftk-version-history/
3
This worked very good for me. One should add that in the input file above theBookmarkBegintags before each bookmark entry are missing.
– danielp
Jul 21 '14 at 20:01
add a comment |
It looks to me like from version 1.45 (2012-12-06), pdftk does allow modification of bookmarks via the update_info command:
You can now add or change a PDF’s bookmarks using update_info.
via:
http://www.pdflabs.com/docs/pdftk-version-history/
It looks to me like from version 1.45 (2012-12-06), pdftk does allow modification of bookmarks via the update_info command:
You can now add or change a PDF’s bookmarks using update_info.
via:
http://www.pdflabs.com/docs/pdftk-version-history/
answered Apr 15 '13 at 3:58
user37186user37186
13612
13612
3
This worked very good for me. One should add that in the input file above theBookmarkBegintags before each bookmark entry are missing.
– danielp
Jul 21 '14 at 20:01
add a comment |
3
This worked very good for me. One should add that in the input file above theBookmarkBegintags before each bookmark entry are missing.
– danielp
Jul 21 '14 at 20:01
3
3
This worked very good for me. One should add that in the input file above the
BookmarkBegin tags before each bookmark entry are missing.– danielp
Jul 21 '14 at 20:01
This worked very good for me. One should add that in the input file above the
BookmarkBegin tags before each bookmark entry are missing.– danielp
Jul 21 '14 at 20:01
add a comment |
jPDFtweak (Java, so runs on Unix/Linux) can alter bookmarks, but I don't know if you can script anything with it.
For scripting, I'd guess your only native Unix/Linux option would be pdflatex with the pdfpages package. But that's a learning curve if you're not already a LaTeX user.
EDIT: Actually it may be possible with ghostscript: See here or here or
here
add a comment |
jPDFtweak (Java, so runs on Unix/Linux) can alter bookmarks, but I don't know if you can script anything with it.
For scripting, I'd guess your only native Unix/Linux option would be pdflatex with the pdfpages package. But that's a learning curve if you're not already a LaTeX user.
EDIT: Actually it may be possible with ghostscript: See here or here or
here
add a comment |
jPDFtweak (Java, so runs on Unix/Linux) can alter bookmarks, but I don't know if you can script anything with it.
For scripting, I'd guess your only native Unix/Linux option would be pdflatex with the pdfpages package. But that's a learning curve if you're not already a LaTeX user.
EDIT: Actually it may be possible with ghostscript: See here or here or
here
jPDFtweak (Java, so runs on Unix/Linux) can alter bookmarks, but I don't know if you can script anything with it.
For scripting, I'd guess your only native Unix/Linux option would be pdflatex with the pdfpages package. But that's a learning curve if you're not already a LaTeX user.
EDIT: Actually it may be possible with ghostscript: See here or here or
here
edited May 23 '17 at 12:40
Community♦
1
1
answered Aug 12 '11 at 0:00
frabjousfrabjous
4,3371825
4,3371825
add a comment |
add a comment |
If you still stick with those unix scripts, then
- extract bookmark data dumped from
pdftk
- write one extra script to convert dumped bookmark data to pdfmarks format, which ghostscript command
gsis accepted. - use
gsscript to merge them together with pdfmarks
Take a look at http://blog.tremily.us/posts/PDF_bookmarks_with_Ghostscript/ the script pdf-merge.py do exactly what you (or I) want.
pdf-merge.py --output=merged.pdf input1.pdf input2.pdf
Some minor improvements could be done in his script
- unicode handling
- output bookmark files, so people can adjust it as well
Anyway, it should work
One upvote! Thanks! I am looking forward to your script!
– Tim
Feb 7 '12 at 3:14
Seems the link is not working. Can you fix it please?
– Fish Monitor
Jul 22 '13 at 6:42
add a comment |
If you still stick with those unix scripts, then
- extract bookmark data dumped from
pdftk
- write one extra script to convert dumped bookmark data to pdfmarks format, which ghostscript command
gsis accepted. - use
gsscript to merge them together with pdfmarks
Take a look at http://blog.tremily.us/posts/PDF_bookmarks_with_Ghostscript/ the script pdf-merge.py do exactly what you (or I) want.
pdf-merge.py --output=merged.pdf input1.pdf input2.pdf
Some minor improvements could be done in his script
- unicode handling
- output bookmark files, so people can adjust it as well
Anyway, it should work
One upvote! Thanks! I am looking forward to your script!
– Tim
Feb 7 '12 at 3:14
Seems the link is not working. Can you fix it please?
– Fish Monitor
Jul 22 '13 at 6:42
add a comment |
If you still stick with those unix scripts, then
- extract bookmark data dumped from
pdftk
- write one extra script to convert dumped bookmark data to pdfmarks format, which ghostscript command
gsis accepted. - use
gsscript to merge them together with pdfmarks
Take a look at http://blog.tremily.us/posts/PDF_bookmarks_with_Ghostscript/ the script pdf-merge.py do exactly what you (or I) want.
pdf-merge.py --output=merged.pdf input1.pdf input2.pdf
Some minor improvements could be done in his script
- unicode handling
- output bookmark files, so people can adjust it as well
Anyway, it should work
If you still stick with those unix scripts, then
- extract bookmark data dumped from
pdftk
- write one extra script to convert dumped bookmark data to pdfmarks format, which ghostscript command
gsis accepted. - use
gsscript to merge them together with pdfmarks
Take a look at http://blog.tremily.us/posts/PDF_bookmarks_with_Ghostscript/ the script pdf-merge.py do exactly what you (or I) want.
pdf-merge.py --output=merged.pdf input1.pdf input2.pdf
Some minor improvements could be done in his script
- unicode handling
- output bookmark files, so people can adjust it as well
Anyway, it should work
edited Jul 30 '13 at 5:43
answered Feb 7 '12 at 3:12
larrycailarrycai
2821210
2821210
One upvote! Thanks! I am looking forward to your script!
– Tim
Feb 7 '12 at 3:14
Seems the link is not working. Can you fix it please?
– Fish Monitor
Jul 22 '13 at 6:42
add a comment |
One upvote! Thanks! I am looking forward to your script!
– Tim
Feb 7 '12 at 3:14
Seems the link is not working. Can you fix it please?
– Fish Monitor
Jul 22 '13 at 6:42
One upvote! Thanks! I am looking forward to your script!
– Tim
Feb 7 '12 at 3:14
One upvote! Thanks! I am looking forward to your script!
– Tim
Feb 7 '12 at 3:14
Seems the link is not working. Can you fix it please?
– Fish Monitor
Jul 22 '13 at 6:42
Seems the link is not working. Can you fix it please?
– Fish Monitor
Jul 22 '13 at 6:42
add a comment |
pdftk is definetly the right tool (with the right syntax):
BookmarkBegin
BookmarkTitle: Chapter 1
BookmarkLevel: 1
BookmarkPageNumber: 1
BookmarkBegin
BookmarkTitle: Paragraph 1.1
BookmarkLevel: 2
BookmarkPageNumber: 1
add a comment |
pdftk is definetly the right tool (with the right syntax):
BookmarkBegin
BookmarkTitle: Chapter 1
BookmarkLevel: 1
BookmarkPageNumber: 1
BookmarkBegin
BookmarkTitle: Paragraph 1.1
BookmarkLevel: 2
BookmarkPageNumber: 1
add a comment |
pdftk is definetly the right tool (with the right syntax):
BookmarkBegin
BookmarkTitle: Chapter 1
BookmarkLevel: 1
BookmarkPageNumber: 1
BookmarkBegin
BookmarkTitle: Paragraph 1.1
BookmarkLevel: 2
BookmarkPageNumber: 1
pdftk is definetly the right tool (with the right syntax):
BookmarkBegin
BookmarkTitle: Chapter 1
BookmarkLevel: 1
BookmarkPageNumber: 1
BookmarkBegin
BookmarkTitle: Paragraph 1.1
BookmarkLevel: 2
BookmarkPageNumber: 1
answered May 27 '15 at 10:40
carlocarlo
311
311
add a comment |
add a comment |
Caleb,
As far as I understand, bookmarks as per the PDF spec can't be injected via a diagnostic tool like pdftk. Updating the metadata to refer to chapters and bookmark landing anchors that don't exist will definitely not work, it may even make your PDF inconsistent or unopenable.
I ended up using java+iText libraries to do what you're suggesting as per this tutorial, but we're dealing with hundreds of pdfs daily, so it needed to be automated. If you're doing a one-off, Adobe Acrobat should be able to do this.
add a comment |
Caleb,
As far as I understand, bookmarks as per the PDF spec can't be injected via a diagnostic tool like pdftk. Updating the metadata to refer to chapters and bookmark landing anchors that don't exist will definitely not work, it may even make your PDF inconsistent or unopenable.
I ended up using java+iText libraries to do what you're suggesting as per this tutorial, but we're dealing with hundreds of pdfs daily, so it needed to be automated. If you're doing a one-off, Adobe Acrobat should be able to do this.
add a comment |
Caleb,
As far as I understand, bookmarks as per the PDF spec can't be injected via a diagnostic tool like pdftk. Updating the metadata to refer to chapters and bookmark landing anchors that don't exist will definitely not work, it may even make your PDF inconsistent or unopenable.
I ended up using java+iText libraries to do what you're suggesting as per this tutorial, but we're dealing with hundreds of pdfs daily, so it needed to be automated. If you're doing a one-off, Adobe Acrobat should be able to do this.
Caleb,
As far as I understand, bookmarks as per the PDF spec can't be injected via a diagnostic tool like pdftk. Updating the metadata to refer to chapters and bookmark landing anchors that don't exist will definitely not work, it may even make your PDF inconsistent or unopenable.
I ended up using java+iText libraries to do what you're suggesting as per this tutorial, but we're dealing with hundreds of pdfs daily, so it needed to be automated. If you're doing a one-off, Adobe Acrobat should be able to do this.
answered Aug 11 '11 at 23:41
r00fusr00fus
1212
1212
add a comment |
add a comment |
To summarise all this good answers:
There is bmconverter project on GitHub that can convert various PDF bookmark formats. It can convert pdftk output to jpdftweak format, although if you will use jpdftweak then you wont need to convert pdftk output to csv, as you can do all work from within jpdftweak.
Unfortunately pdfmarks is not supported by the project, but fortunately someone posted script in bmconverter issues that can convert pdftk output to pdfmarks. So ghostscript batch option is an option
add a comment |
To summarise all this good answers:
There is bmconverter project on GitHub that can convert various PDF bookmark formats. It can convert pdftk output to jpdftweak format, although if you will use jpdftweak then you wont need to convert pdftk output to csv, as you can do all work from within jpdftweak.
Unfortunately pdfmarks is not supported by the project, but fortunately someone posted script in bmconverter issues that can convert pdftk output to pdfmarks. So ghostscript batch option is an option
add a comment |
To summarise all this good answers:
There is bmconverter project on GitHub that can convert various PDF bookmark formats. It can convert pdftk output to jpdftweak format, although if you will use jpdftweak then you wont need to convert pdftk output to csv, as you can do all work from within jpdftweak.
Unfortunately pdfmarks is not supported by the project, but fortunately someone posted script in bmconverter issues that can convert pdftk output to pdfmarks. So ghostscript batch option is an option
To summarise all this good answers:
There is bmconverter project on GitHub that can convert various PDF bookmark formats. It can convert pdftk output to jpdftweak format, although if you will use jpdftweak then you wont need to convert pdftk output to csv, as you can do all work from within jpdftweak.
Unfortunately pdfmarks is not supported by the project, but fortunately someone posted script in bmconverter issues that can convert pdftk output to pdfmarks. So ghostscript batch option is an option
answered Apr 19 '12 at 9:45
zetahzetah
69241019
69241019
add a comment |
add a comment |
pdftk bookmark format is a little bit tedious to write. Instead I created my own script using bash, sed, pdftk and python3. Check it out at this repo: https://github.com/SiddharthPant/booky
So now I can create a text file(bkmrks.txt) like this which takes just 5 minutes to write even for a 1000 page pdf.
{
Title1, 1
Title2, 2
{
Subtitle1, 3
Subtitle2, 4
{
SubSubtitle1, 5
...
}
}
}
and then use my script
./booky.sh pdf_file.pdf bkmrks.txt
this automatically creates a pdf(pdf_file_new.pdf) that has my bookmarks in it.
add a comment |
pdftk bookmark format is a little bit tedious to write. Instead I created my own script using bash, sed, pdftk and python3. Check it out at this repo: https://github.com/SiddharthPant/booky
So now I can create a text file(bkmrks.txt) like this which takes just 5 minutes to write even for a 1000 page pdf.
{
Title1, 1
Title2, 2
{
Subtitle1, 3
Subtitle2, 4
{
SubSubtitle1, 5
...
}
}
}
and then use my script
./booky.sh pdf_file.pdf bkmrks.txt
this automatically creates a pdf(pdf_file_new.pdf) that has my bookmarks in it.
add a comment |
pdftk bookmark format is a little bit tedious to write. Instead I created my own script using bash, sed, pdftk and python3. Check it out at this repo: https://github.com/SiddharthPant/booky
So now I can create a text file(bkmrks.txt) like this which takes just 5 minutes to write even for a 1000 page pdf.
{
Title1, 1
Title2, 2
{
Subtitle1, 3
Subtitle2, 4
{
SubSubtitle1, 5
...
}
}
}
and then use my script
./booky.sh pdf_file.pdf bkmrks.txt
this automatically creates a pdf(pdf_file_new.pdf) that has my bookmarks in it.
pdftk bookmark format is a little bit tedious to write. Instead I created my own script using bash, sed, pdftk and python3. Check it out at this repo: https://github.com/SiddharthPant/booky
So now I can create a text file(bkmrks.txt) like this which takes just 5 minutes to write even for a 1000 page pdf.
{
Title1, 1
Title2, 2
{
Subtitle1, 3
Subtitle2, 4
{
SubSubtitle1, 5
...
}
}
}
and then use my script
./booky.sh pdf_file.pdf bkmrks.txt
this automatically creates a pdf(pdf_file_new.pdf) that has my bookmarks in it.
answered Feb 23 '16 at 12:19
Siddharth PantSiddharth Pant
711
711
add a comment |
add a comment |
Just add BookmarkBegin before each bookmark entry, as in
BookmarkBegin
BookmarkTitle: Front cover
BookmarkLevel: 1
BookmarkPageNumber: 1
BookmarkBegin
⋮
add a comment |
Just add BookmarkBegin before each bookmark entry, as in
BookmarkBegin
BookmarkTitle: Front cover
BookmarkLevel: 1
BookmarkPageNumber: 1
BookmarkBegin
⋮
add a comment |
Just add BookmarkBegin before each bookmark entry, as in
BookmarkBegin
BookmarkTitle: Front cover
BookmarkLevel: 1
BookmarkPageNumber: 1
BookmarkBegin
⋮
Just add BookmarkBegin before each bookmark entry, as in
BookmarkBegin
BookmarkTitle: Front cover
BookmarkLevel: 1
BookmarkPageNumber: 1
BookmarkBegin
⋮
edited Jun 30 '15 at 1:41
G-Man
13.1k93465
13.1k93465
answered Jun 30 '15 at 0:03
tofleploftofleplof
111
111
add a comment |
add a comment |
The redirect that you used in step 1 will cause update_info to not work correctly. You need to specify the output file to pdftk instead:
pdftk in.pdf dump_data output in.info
See this answer from similar question: https://stackoverflow.com/a/30308964/3158933
Files that I created using a redirect have a slightly larger file size and cause pdftk to issue a "Warning: unexpected case 1 in LoadDataFile(); continuing" message when running the update_info command.
New contributor
cnachtmann is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
The redirect that you used in step 1 will cause update_info to not work correctly. You need to specify the output file to pdftk instead:
pdftk in.pdf dump_data output in.info
See this answer from similar question: https://stackoverflow.com/a/30308964/3158933
Files that I created using a redirect have a slightly larger file size and cause pdftk to issue a "Warning: unexpected case 1 in LoadDataFile(); continuing" message when running the update_info command.
New contributor
cnachtmann is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
The redirect that you used in step 1 will cause update_info to not work correctly. You need to specify the output file to pdftk instead:
pdftk in.pdf dump_data output in.info
See this answer from similar question: https://stackoverflow.com/a/30308964/3158933
Files that I created using a redirect have a slightly larger file size and cause pdftk to issue a "Warning: unexpected case 1 in LoadDataFile(); continuing" message when running the update_info command.
New contributor
cnachtmann is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
The redirect that you used in step 1 will cause update_info to not work correctly. You need to specify the output file to pdftk instead:
pdftk in.pdf dump_data output in.info
See this answer from similar question: https://stackoverflow.com/a/30308964/3158933
Files that I created using a redirect have a slightly larger file size and cause pdftk to issue a "Warning: unexpected case 1 in LoadDataFile(); continuing" message when running the update_info command.
New contributor
cnachtmann is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
cnachtmann is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
answered 10 mins ago
cnachtmanncnachtmann
1
1
New contributor
cnachtmann is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
cnachtmann is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
cnachtmann is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f17065%2fadd-and-edit-bookmarks-to-pdf%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
This small graphical tool worked for me. (PDF Mod 0.9.1) apps.fedoraproject.org/packages/pdfmod
– abhijit
Jul 28 '15 at 12:30