How to display the pages of a particular section in another PDF?
I can use this code to display page 5 from a PDF:\externalfigure[filename.pdf][page=5]I am making a teacher's guide for a workbook (workbook.pdf). I need to be able to display on the page all pages of a particular section. The teacher's guide uses the same section titles as the workbook, e.g.: 17-A: Title 17-B: Title In other words, there is 1:1 pairing of section titles in the teacher's guide and the workbook. Is there any way to tell ConTeXt to display all of the pages for a particular section? \externalfigure[filename.pdf][section=17A] --Joel
Don’t know about ConTeXt. But maybe you might want to have a look at pdftk. You could try to produce per-section pdfs and include those.
Best,
Denis
Von: ntg-context
Am 04.12.22 um 23:30 schrieb Joel via ntg-context:
I can use this code to display page 5 from a PDF:
\externalfigure[filename.pdf][page=5]
I am making a teacher's guide for a workbook (workbook.pdf). I need to be able to display on the page all pages of a particular section.
The teacher's guide uses the same section titles as the workbook, e.g.:
17-A: Title 17-B: Title
In other words, there is 1:1 pairing of section titles in the teacher's guide and the workbook.
Is there any way to tell ConTeXt to display all of the pages for a particular section?
\externalfigure[filename.pdf][section=17A]
Use a loop in Lua or TeX: https://wiki.contextgarden.net/System_Macros/Loops_and_Recursion \dostepwiserecurse {5} {17} {1} {\externalfigure[filename.pdf][page=\recurselevel]} or \startluacode for s=5, 17 do context.externalfigure({"filename.pdf"},{page=s}) end \stopluacode (untested) Hraban
I can use this code to display page 5 from a PDF:
\externalfigure[filename.pdf][page=5]
I am making a teacher's guide for a workbook (workbook.pdf). I need to be able to display on the page all pages of a particular section.
The teacher's guide uses the same section titles as the workbook, e.g.:
17-A: Title 17-B: Title
In other words, there is 1:1 pairing of section titles in the teacher's guide and the workbook.
Is there any way to tell ConTeXt to display all of the pages for a particular section?
\externalfigure[filename.pdf][section=17A]
On 12/4/2022 11:30 PM, Joel via ntg-context wrote: prototype attached (first process crap, then load) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
On 12/5/22 13:13, Hans Hagen via ntg-context wrote:
On 12/4/2022 11:30 PM, Joel via ntg-context wrote:
I can use this code to display page 5 from a PDF: [...] \externalfigure[filename.pdf][section=17A]
prototype attached (first process crap, then load)
Hi Hans, it would be great to have something like: \loadsection [1] [2] [3] 1 FILE 2 REFERENCE 3 inherits from \setupexternalfigure Just in case it may be relevant to the discussion. Many thanks for your help, Pablo
On 12/5/22 13:13, Hans Hagen via ntg-context wrote:
On 12/4/2022 11:30 PM, Joel via ntg-context wrote:
I can use this code to display page 5 from a PDF: [...] \externalfigure[filename.pdf][section=17A]
prototype attached (first process crap, then load)
Hi Hans,
it would be great to have something like:
\loadsection [1] [2] [3]
1 FILE 2 REFERENCE 3 inherits from \setupexternalfigure
Just in case it may be relevant to the discussion.
On 12/5/2022 5:39 PM, Pablo Rodriguez via ntg-context wrote: that is not flexible ... we're talking about a rather special application, so what I can add is a simple helper that returns the first and last page of a section \dostepwiserecurse {\firstsectionpage[crap][chapter:3]} {\lastsectionpage[crap][chapter:3]} {1} { \startpagemakeup \externalfigure[crap.pdf][page=#1] \stoppagemakeup } \dostepwiserecurse {\firstsectionpage[crap][chapter:5]} {\lastsectionpage[crap][chapter:5]} {1} { \dontleavehmode \externalfigure[crap.pdf][page=#1,width=3cm,frame=on]% \space\allowbreak } keep in mind that it is also a biut fragile as one never know where the last one ends Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
On 12/5/22 18:30, Hans Hagen via ntg-context wrote:
[...] it would be great to have something like:
\loadsection [1] [2] [3] [...]
On 12/5/2022 5:39 PM, Pablo Rodriguez via ntg-context wrote: that is not flexible ... we're talking about a rather special application, so what I can add is a simple helper that returns the first and last page of a section
That would be great for me.
keep in mind that it is also a biut fragile as one never know where the last one ends
I wondered whether \doifreference{\lastsectionpage[file][reference]} would make sense here, but this would probably be a way of unnecesarily complicating things... Many thanks for your help, Pablo
On 12/5/2022 7:23 PM, Pablo Rodriguez via ntg-context wrote:
On 12/5/22 18:30, Hans Hagen via ntg-context wrote:
[...] it would be great to have something like:
\loadsection [1] [2] [3] [...]
On 12/5/2022 5:39 PM, Pablo Rodriguez via ntg-context wrote: that is not flexible ... we're talking about a rather special application, so what I can add is a simple helper that returns the first and last page of a section
That would be great for me.
keep in mind that it is also a biut fragile as one never know where the last one ends
I wondered whether \doifreference{\lastsectionpage[file][reference]} would make sense here, but this would probably be a way of unnecesarily complicating things... for sure complicating, as i have no cleu what that would mean
Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
I can use this code to display page 5 from a PDF:
\externalfigure[filename.pdf][page=5]
I am making a teacher's guide for a workbook (workbook.pdf). I need to be able to display on the page all pages of a particular section.
The teacher's guide uses the same section titles as the workbook, e.g.:
17-A: Title 17-B: Title
In other words, there is 1:1 pairing of section titles in the teacher's guide and the workbook.
Is there any way to tell ConTeXt to display all of the pages for a particular section?
\externalfigure[filename.pdf][section=17A]
Thanks so much! It took some work for me to figure out how to make it work, but it now works great!
--Joel
On Monday, December 5, 2022 at 05:15:49 AM MST, Hans Hagen via ntg-context
On 12/6/2022 1:39 AM, Joel wrote:
Thanks so much! It took some work for me to figure out how to make it work, but it now works great! i added \firstsectionpage and \lastsectionpage that (i guess) Pablo will document at the wiki
Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
On 12/6/22 09:05, Hans Hagen via ntg-context wrote:
On 12/6/2022 1:39 AM, Joel wrote:
Thanks so much! It took some work for me to figure out how to make it work, but it now works great! i added \firstsectionpage and \lastsectionpage that (i guess) Pablo will document at the wiki
Many thanks for the implementation, Hans. https://wiki.contextgarden.net/Including_pages_from_PDF_documents contains the new information (please, Joel, could you check whether the explanation is clear?). But I’m afraid I’m seeing a potential problem here, if the source PDF is doublesided, \lastsectionpage from a reference may be an empty page. Many thanks for your help, Pablo
On 12/6/2022 6:33 PM, Pablo Rodriguez via ntg-context wrote:
On 12/6/22 09:05, Hans Hagen via ntg-context wrote:
On 12/6/2022 1:39 AM, Joel wrote:
Thanks so much! It took some work for me to figure out how to make it work, but it now works great! i added \firstsectionpage and \lastsectionpage that (i guess) Pablo will document at the wiki
Many thanks for the implementation, Hans.
https://wiki.contextgarden.net/Including_pages_from_PDF_documents contains the new information (please, Joel, could you check whether the explanation is clear?).
But I’m afraid I’m seeing a potential problem here, if the source PDF is doublesided, \lastsectionpage from a reference may be an empty page. There is not much we do about that. Oen can then do
{\numexpr\lastsectionpage... -1\relax} Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
participants (6)
-
denis.maier@unibe.ch
-
Hans Hagen
-
Hans Hagen
-
Henning Hraban Ramm
-
Joel
-
Pablo Rodriguez