How to read %%Pages:… from *.xbb file
Given the auxiliary file test.xbb
%%Title: test.pdf
%%Creator: extractbb 20180506
%%BoundingBox: 0 0 300 343
%%HiResBoundingBox: 0.000000 0.000000 300.290000 342.810000
%%PDFVersion: 1.4
%%Pages: 17
%%CreationDate: Mon Jan 7 18:06:49 2019
produced from input file test.pdf
using the extractbb
utility
extractbb test.pdf
Is there an easy way to read the value of the %%Pages:
key from test.xbb
by means of some internal command defined in the graphics
package? I know that graphics
parses user provided xbb
files in order to determine bounding-box coordinates for binary-type or compressed image files that TeX cannot read on its own. Can it do the same for %%Pages:
out of the box?
graphics pdf
|
show 3 more comments
Given the auxiliary file test.xbb
%%Title: test.pdf
%%Creator: extractbb 20180506
%%BoundingBox: 0 0 300 343
%%HiResBoundingBox: 0.000000 0.000000 300.290000 342.810000
%%PDFVersion: 1.4
%%Pages: 17
%%CreationDate: Mon Jan 7 18:06:49 2019
produced from input file test.pdf
using the extractbb
utility
extractbb test.pdf
Is there an easy way to read the value of the %%Pages:
key from test.xbb
by means of some internal command defined in the graphics
package? I know that graphics
parses user provided xbb
files in order to determine bounding-box coordinates for binary-type or compressed image files that TeX cannot read on its own. Can it do the same for %%Pages:
out of the box?
graphics pdf
1
Are you interested in Get number of pages of external PDF?
– Werner
4 hours ago
Yes, but without usingpdftex
,luatex
,xetex
, just by readingxbb
while running(pdf|lua)latex
in DVI mode.
– AlexG
4 hours ago
I see nothing in the code. It wouldn't imho be very difficult to add it, but can't you read the xbb yourself?
– Ulrike Fischer
4 hours ago
@UlrikeFischer : Thank you. It would be nice if such a thing would already exist, but maybe I will have to homebrew something myself based ongraphics
code.
– AlexG
4 hours ago
actually main thing you'd have to change is the code that makes it stop reading the file once it has found a bounding box.... although if you know it's a xbb file with that format rather than arbitrary eps file, it might be as easy to simply input it rather than use theread
loop from graphics
– David Carlisle
3 hours ago
|
show 3 more comments
Given the auxiliary file test.xbb
%%Title: test.pdf
%%Creator: extractbb 20180506
%%BoundingBox: 0 0 300 343
%%HiResBoundingBox: 0.000000 0.000000 300.290000 342.810000
%%PDFVersion: 1.4
%%Pages: 17
%%CreationDate: Mon Jan 7 18:06:49 2019
produced from input file test.pdf
using the extractbb
utility
extractbb test.pdf
Is there an easy way to read the value of the %%Pages:
key from test.xbb
by means of some internal command defined in the graphics
package? I know that graphics
parses user provided xbb
files in order to determine bounding-box coordinates for binary-type or compressed image files that TeX cannot read on its own. Can it do the same for %%Pages:
out of the box?
graphics pdf
Given the auxiliary file test.xbb
%%Title: test.pdf
%%Creator: extractbb 20180506
%%BoundingBox: 0 0 300 343
%%HiResBoundingBox: 0.000000 0.000000 300.290000 342.810000
%%PDFVersion: 1.4
%%Pages: 17
%%CreationDate: Mon Jan 7 18:06:49 2019
produced from input file test.pdf
using the extractbb
utility
extractbb test.pdf
Is there an easy way to read the value of the %%Pages:
key from test.xbb
by means of some internal command defined in the graphics
package? I know that graphics
parses user provided xbb
files in order to determine bounding-box coordinates for binary-type or compressed image files that TeX cannot read on its own. Can it do the same for %%Pages:
out of the box?
graphics pdf
graphics pdf
asked 4 hours ago
AlexGAlexG
32.3k479143
32.3k479143
1
Are you interested in Get number of pages of external PDF?
– Werner
4 hours ago
Yes, but without usingpdftex
,luatex
,xetex
, just by readingxbb
while running(pdf|lua)latex
in DVI mode.
– AlexG
4 hours ago
I see nothing in the code. It wouldn't imho be very difficult to add it, but can't you read the xbb yourself?
– Ulrike Fischer
4 hours ago
@UlrikeFischer : Thank you. It would be nice if such a thing would already exist, but maybe I will have to homebrew something myself based ongraphics
code.
– AlexG
4 hours ago
actually main thing you'd have to change is the code that makes it stop reading the file once it has found a bounding box.... although if you know it's a xbb file with that format rather than arbitrary eps file, it might be as easy to simply input it rather than use theread
loop from graphics
– David Carlisle
3 hours ago
|
show 3 more comments
1
Are you interested in Get number of pages of external PDF?
– Werner
4 hours ago
Yes, but without usingpdftex
,luatex
,xetex
, just by readingxbb
while running(pdf|lua)latex
in DVI mode.
– AlexG
4 hours ago
I see nothing in the code. It wouldn't imho be very difficult to add it, but can't you read the xbb yourself?
– Ulrike Fischer
4 hours ago
@UlrikeFischer : Thank you. It would be nice if such a thing would already exist, but maybe I will have to homebrew something myself based ongraphics
code.
– AlexG
4 hours ago
actually main thing you'd have to change is the code that makes it stop reading the file once it has found a bounding box.... although if you know it's a xbb file with that format rather than arbitrary eps file, it might be as easy to simply input it rather than use theread
loop from graphics
– David Carlisle
3 hours ago
1
1
Are you interested in Get number of pages of external PDF?
– Werner
4 hours ago
Are you interested in Get number of pages of external PDF?
– Werner
4 hours ago
Yes, but without using
pdftex
, luatex
, xetex
, just by reading xbb
while running (pdf|lua)latex
in DVI mode.– AlexG
4 hours ago
Yes, but without using
pdftex
, luatex
, xetex
, just by reading xbb
while running (pdf|lua)latex
in DVI mode.– AlexG
4 hours ago
I see nothing in the code. It wouldn't imho be very difficult to add it, but can't you read the xbb yourself?
– Ulrike Fischer
4 hours ago
I see nothing in the code. It wouldn't imho be very difficult to add it, but can't you read the xbb yourself?
– Ulrike Fischer
4 hours ago
@UlrikeFischer : Thank you. It would be nice if such a thing would already exist, but maybe I will have to homebrew something myself based on
graphics
code.– AlexG
4 hours ago
@UlrikeFischer : Thank you. It would be nice if such a thing would already exist, but maybe I will have to homebrew something myself based on
graphics
code.– AlexG
4 hours ago
actually main thing you'd have to change is the code that makes it stop reading the file once it has found a bounding box.... although if you know it's a xbb file with that format rather than arbitrary eps file, it might be as easy to simply input it rather than use the
read
loop from graphics– David Carlisle
3 hours ago
actually main thing you'd have to change is the code that makes it stop reading the file once it has found a bounding box.... although if you know it's a xbb file with that format rather than arbitrary eps file, it might be as easy to simply input it rather than use the
read
loop from graphics– David Carlisle
3 hours ago
|
show 3 more comments
1 Answer
1
active
oldest
votes
documentclass{article}
begin{document}
{%
def%#1:#2@{expandafterxdefcsname ZZ#1endcsname{#2}}%
endlinechar`@ %
catcode`%=0 sbox0{input{test.xbb}}}%
Pages: ZZPages
end{document}
Oh my, you are the greatest! Thank you!
– AlexG
3 hours ago
Would you please explain whyinput
must be placed into an sbox? To prevent any typeset output?
– AlexG
3 hours ago
@AlexG try without:-) yes as you say it throws away any accidental typeset result, in fact you get a typeset@
from the final newline, which could be avoided in other ways but....
– David Carlisle
3 hours ago
Ok. Very smart! And what about the double percent sign in the input? I can see only one%
indef%...
– AlexG
3 hours ago
@AlexG if%
has catcode 0 (escape character ) then%%
references the same command as%
the command with name%
just as\
references the command with name
– David Carlisle
3 hours ago
|
show 3 more comments
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
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%2ftex.stackexchange.com%2fquestions%2f469024%2fhow-to-read-pages-from-xbb-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
documentclass{article}
begin{document}
{%
def%#1:#2@{expandafterxdefcsname ZZ#1endcsname{#2}}%
endlinechar`@ %
catcode`%=0 sbox0{input{test.xbb}}}%
Pages: ZZPages
end{document}
Oh my, you are the greatest! Thank you!
– AlexG
3 hours ago
Would you please explain whyinput
must be placed into an sbox? To prevent any typeset output?
– AlexG
3 hours ago
@AlexG try without:-) yes as you say it throws away any accidental typeset result, in fact you get a typeset@
from the final newline, which could be avoided in other ways but....
– David Carlisle
3 hours ago
Ok. Very smart! And what about the double percent sign in the input? I can see only one%
indef%...
– AlexG
3 hours ago
@AlexG if%
has catcode 0 (escape character ) then%%
references the same command as%
the command with name%
just as\
references the command with name
– David Carlisle
3 hours ago
|
show 3 more comments
documentclass{article}
begin{document}
{%
def%#1:#2@{expandafterxdefcsname ZZ#1endcsname{#2}}%
endlinechar`@ %
catcode`%=0 sbox0{input{test.xbb}}}%
Pages: ZZPages
end{document}
Oh my, you are the greatest! Thank you!
– AlexG
3 hours ago
Would you please explain whyinput
must be placed into an sbox? To prevent any typeset output?
– AlexG
3 hours ago
@AlexG try without:-) yes as you say it throws away any accidental typeset result, in fact you get a typeset@
from the final newline, which could be avoided in other ways but....
– David Carlisle
3 hours ago
Ok. Very smart! And what about the double percent sign in the input? I can see only one%
indef%...
– AlexG
3 hours ago
@AlexG if%
has catcode 0 (escape character ) then%%
references the same command as%
the command with name%
just as\
references the command with name
– David Carlisle
3 hours ago
|
show 3 more comments
documentclass{article}
begin{document}
{%
def%#1:#2@{expandafterxdefcsname ZZ#1endcsname{#2}}%
endlinechar`@ %
catcode`%=0 sbox0{input{test.xbb}}}%
Pages: ZZPages
end{document}
documentclass{article}
begin{document}
{%
def%#1:#2@{expandafterxdefcsname ZZ#1endcsname{#2}}%
endlinechar`@ %
catcode`%=0 sbox0{input{test.xbb}}}%
Pages: ZZPages
end{document}
edited 3 hours ago
answered 3 hours ago
David CarlisleDavid Carlisle
483k4011171858
483k4011171858
Oh my, you are the greatest! Thank you!
– AlexG
3 hours ago
Would you please explain whyinput
must be placed into an sbox? To prevent any typeset output?
– AlexG
3 hours ago
@AlexG try without:-) yes as you say it throws away any accidental typeset result, in fact you get a typeset@
from the final newline, which could be avoided in other ways but....
– David Carlisle
3 hours ago
Ok. Very smart! And what about the double percent sign in the input? I can see only one%
indef%...
– AlexG
3 hours ago
@AlexG if%
has catcode 0 (escape character ) then%%
references the same command as%
the command with name%
just as\
references the command with name
– David Carlisle
3 hours ago
|
show 3 more comments
Oh my, you are the greatest! Thank you!
– AlexG
3 hours ago
Would you please explain whyinput
must be placed into an sbox? To prevent any typeset output?
– AlexG
3 hours ago
@AlexG try without:-) yes as you say it throws away any accidental typeset result, in fact you get a typeset@
from the final newline, which could be avoided in other ways but....
– David Carlisle
3 hours ago
Ok. Very smart! And what about the double percent sign in the input? I can see only one%
indef%...
– AlexG
3 hours ago
@AlexG if%
has catcode 0 (escape character ) then%%
references the same command as%
the command with name%
just as\
references the command with name
– David Carlisle
3 hours ago
Oh my, you are the greatest! Thank you!
– AlexG
3 hours ago
Oh my, you are the greatest! Thank you!
– AlexG
3 hours ago
Would you please explain why
input
must be placed into an sbox? To prevent any typeset output?– AlexG
3 hours ago
Would you please explain why
input
must be placed into an sbox? To prevent any typeset output?– AlexG
3 hours ago
@AlexG try without:-) yes as you say it throws away any accidental typeset result, in fact you get a typeset
@
from the final newline, which could be avoided in other ways but....– David Carlisle
3 hours ago
@AlexG try without:-) yes as you say it throws away any accidental typeset result, in fact you get a typeset
@
from the final newline, which could be avoided in other ways but....– David Carlisle
3 hours ago
Ok. Very smart! And what about the double percent sign in the input? I can see only one
%
in def%...
– AlexG
3 hours ago
Ok. Very smart! And what about the double percent sign in the input? I can see only one
%
in def%...
– AlexG
3 hours ago
@AlexG if
%
has catcode 0 (escape character ) then %%
references the same command as %
the command with name %
just as \
references the command with name
– David Carlisle
3 hours ago
@AlexG if
%
has catcode 0 (escape character ) then %%
references the same command as %
the command with name %
just as \
references the command with name
– David Carlisle
3 hours ago
|
show 3 more comments
Thanks for contributing an answer to TeX - LaTeX 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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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%2ftex.stackexchange.com%2fquestions%2f469024%2fhow-to-read-pages-from-xbb-file%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
1
Are you interested in Get number of pages of external PDF?
– Werner
4 hours ago
Yes, but without using
pdftex
,luatex
,xetex
, just by readingxbb
while running(pdf|lua)latex
in DVI mode.– AlexG
4 hours ago
I see nothing in the code. It wouldn't imho be very difficult to add it, but can't you read the xbb yourself?
– Ulrike Fischer
4 hours ago
@UlrikeFischer : Thank you. It would be nice if such a thing would already exist, but maybe I will have to homebrew something myself based on
graphics
code.– AlexG
4 hours ago
actually main thing you'd have to change is the code that makes it stop reading the file once it has found a bounding box.... although if you know it's a xbb file with that format rather than arbitrary eps file, it might be as easy to simply input it rather than use the
read
loop from graphics– David Carlisle
3 hours ago