Export long texts to PDF?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Export long texts to PDF?
Hi all,
I'm in the process of converting FileMaker Pro apps to LC and the nearly at the end of doing this for one of my more heavily used apps, which needs to export PDF as its final output.
The length is variable and can span several pages, which is quite easy to accommodate for in FMP with layouts designed for printing with fields that shrink/shift on preview/printing depending on content length.
I'm not clear on what the workflow would be to create a PDF of fields with formattedHeight longer than the card they are on?
I looked at the lesson https://lessons.livecode.com/m/4071/l/2 ... g-livecode but this isn't quite what i need... it only prints what is visible on the screen.
Is there a simpler way to export/print to PDF fields of variable length that may span the equivalent of several cards?
Or would i have to paginate this myself, create new cards on the fly (i guess based somehow on the formattedHeight of the field on each page) and then print all cards to PDF as per the less above? (seems rather tedious...)
Grateful for your suggestions!
Stam
I'm in the process of converting FileMaker Pro apps to LC and the nearly at the end of doing this for one of my more heavily used apps, which needs to export PDF as its final output.
The length is variable and can span several pages, which is quite easy to accommodate for in FMP with layouts designed for printing with fields that shrink/shift on preview/printing depending on content length.
I'm not clear on what the workflow would be to create a PDF of fields with formattedHeight longer than the card they are on?
I looked at the lesson https://lessons.livecode.com/m/4071/l/2 ... g-livecode but this isn't quite what i need... it only prints what is visible on the screen.
Is there a simpler way to export/print to PDF fields of variable length that may span the equivalent of several cards?
Or would i have to paginate this myself, create new cards on the fly (i guess based somehow on the formattedHeight of the field on each page) and then print all cards to PDF as per the less above? (seems rather tedious...)
Grateful for your suggestions!
Stam
Re: Export long texts to PDF?
Hi Stam,
I would:
1. Hide the scrollbars of the field
2. put "Page 1" into fld "pagination"
3. print the card
3a. print break
4. scroll the fields content via script and
5. put "Page 2" into fld "pagination"
6. print the card
6a. print break
etc...
You get the picture.
Best
Klaus
I would:
1. Hide the scrollbars of the field
2. put "Page 1" into fld "pagination"
3. print the card
3a. print break
4. scroll the fields content via script and
5. put "Page 2" into fld "pagination"
6. print the card
6a. print break
etc...
You get the picture.
Best
Klaus
-
- Livecode Opensource Backer
- Posts: 9379
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Export long texts to PDF?
Simple stuff: so will not keep Klaus happy:
Code: Select all
on mouseUp
ask file "Save as:" with "Print.pdf"
put it into tFileName
if tFileName is empty then exit to top
set the printerOutput to "file:" & tFileName
revShowPrintDialog false, false
revPrintField the long name of fld "GUFF"
end mouseUp
- Attachments
-
- PDF Xport.livecode.zip
- Stack.
- (2.36 KiB) Downloaded 66 times
Re: Export long texts to PDF?
Thank you both!
@Richmond - i had looked at revPrintField but didn't realise i could use it to create PDF by setting the printerOutput to a file.pdf -- thank you hilighting this!
Unfortunately it's not a simple matter of just printing one field though, this is would be a formal letter representing the output of tertiary centre medical multidisciplinary discussion, so has to have several elements - a complex header than represent the hospital and the department, footers etc; plus needs some fancy formatting/layout which means ideally including multiple fields in various locations - it's just the 'middle' bit that would print in a stream.
Or can revPrintField be used to create just a section in the PDF?
@Klaus - that seems very usable! I'll probably still have to create an additional card as needed on the fly as the first page is very different from subsequent pages but it seems more doable now -- thank you!
great forum
regards
Stam
@Richmond - i had looked at revPrintField but didn't realise i could use it to create PDF by setting the printerOutput to a file.pdf -- thank you hilighting this!
Unfortunately it's not a simple matter of just printing one field though, this is would be a formal letter representing the output of tertiary centre medical multidisciplinary discussion, so has to have several elements - a complex header than represent the hospital and the department, footers etc; plus needs some fancy formatting/layout which means ideally including multiple fields in various locations - it's just the 'middle' bit that would print in a stream.
Or can revPrintField be used to create just a section in the PDF?
@Klaus - that seems very usable! I'll probably still have to create an additional card as needed on the fly as the first page is very different from subsequent pages but it seems more doable now -- thank you!
great forum
regards
Stam
Re: Export long texts to PDF?
Also, looking at the documentation on PrinterOutput:
Does this means that if used on Windows it won't produce PDF? (sadly this is the target platform, as the NHS is 99.9% Microsoft orientated - and yes there is much pain in that...)The printerOutput can be one of the following values. The default value depends on the printer driver - Windows Vista uses XPS format. - UNIX uses PostScript format. - Mac OS X uses PDF format. - Older Windows versions use a system-specific format.
-
- Livecode Opensource Backer
- Posts: 9379
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Export long texts to PDF?
Windows Vista?
Surely not . . . even the NHS.
Um?
https://lessons.livecode.com/m/4071/l/2 ... g-livecode
http://lists.runrev.com/pipermail/use-l ... 41532.html
Surely not . . . even the NHS.
Um?
https://lessons.livecode.com/m/4071/l/2 ... g-livecode
http://lists.runrev.com/pipermail/use-l ... 41532.html
-
- VIP Livecode Opensource Backer
- Posts: 9655
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Export long texts to PDF?
Stam.
I use the "open printing to pdf" command:
Also, however many ancillary fields are required, they should not impact the central issue. These can be populated as required, and the successive data in the main field loaded and printed as the others have said.
Craig
I use the "open printing to pdf" command:
Code: Select all
get the deskTop folder -- or wherever...
open printing to pdf it & "/" & yourJob & ".pdf"
print yourCard from "8,10" to "564,646" --or, er, wherever
close printing
Craig
Re: Export long texts to PDF?
Thanks Raymond - but I already included the same lesson in my OPrichmond62 wrote: ↑Fri Apr 22, 2022 8:56 pmWindows Vista?
Surely not . . . even the NHS.
Um?
https://lessons.livecode.com/m/4071/l/2 ... g-livecode
http://lists.runrev.com/pipermail/use-l ... 41532.html
Re: NHS IT
Just about… it’s actually just over 3 years ago we jumped from Windows XP to Windows 10.
Not a small endeavour for an NHS Trust with over 22,000 employees…
I was not kidding when I said pain is a familiar sensation plaguing NHS IT…
I presume however that the XPS format applies to “windows” in general - or is this different for windows 10/11?
-
- VIP Livecode Opensource Backer
- Posts: 7230
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Export long texts to PDF?
Klaus' suggestion is the recommended way. See the pageHeights property in the dictionary to know how much to scroll the field on each iteration of the loop.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- Livecode Opensource Backer
- Posts: 9379
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Export long texts to PDF?
Klaus' suggestion
One of the things that I have always found annoying is finding a backup of1. Hide the scrollbars of the field
2. put "Page 1" into fld "pagination"
3. print the card
3a. print break
4. scroll the fields content via script and
5. put "Page 2" into fld "pagination"
6. print the card
6a. print break
some text someone wrote in about 1995 that is a PDF WITHOUT an embedded text layer . . .
-
- Livecode Opensource Backer
- Posts: 9379
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Export long texts to PDF?
Code: Select all
on mouseUp
revShowPrintDialog false, true
revPrintField the name of fld "fRESULT"
end mouseUp
-
- Livecode Opensource Backer
- Posts: 9379
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Export long texts to PDF?
Not sure what the 'red' post is about... no one questions whether revPrintField works on all desktop platforms... the question i raised was if this will work to export to directly to PDF, as this would rely on setting the printerOutput to a file - as i understand the documentation, on Windows (albeit 'vista') the file format for printerOutput would appear to be XPS, as opposed to PDF on macOS. If that's not true of more modern Windows OS/LiveCode versions then even better - but still no good for my needs, as i aim to export a dynamic layout, not a single field of text.
As was explained in the OP...
I am more than fully aware both win and mac can 'print to pdf' from the printer setup dialog (on Windows you'd need to select a 'print to pdf' driver), but i don't want my users to have to do that.
This is in fact the very method i've had to use with my FileMaker Pro standalone, as the export to PDF feature wasn't available in standalones for FMP and in any case standalones have now been deprecated and removed from FMPA.
I just want my users to be able to export a PDF file directly. Using the print dialog to do this was was always a lame way to do this... I can't tell you how often this is a point of confusion for non-IT savvy users...
Therefore for me, open printing to pdf is the way to go for this project.
Anyway lots to get my teeth into! Thanks to all for the swift and amazing help!
As was explained in the OP...
I am more than fully aware both win and mac can 'print to pdf' from the printer setup dialog (on Windows you'd need to select a 'print to pdf' driver), but i don't want my users to have to do that.
This is in fact the very method i've had to use with my FileMaker Pro standalone, as the export to PDF feature wasn't available in standalones for FMP and in any case standalones have now been deprecated and removed from FMPA.
I just want my users to be able to export a PDF file directly. Using the print dialog to do this was was always a lame way to do this... I can't tell you how often this is a point of confusion for non-IT savvy users...
Therefore for me, open printing to pdf is the way to go for this project.
Anyway lots to get my teeth into! Thanks to all for the swift and amazing help!
-
- Livecode Opensource Backer
- Posts: 9379
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
-
- Livecode Opensource Backer
- Posts: 9379
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Export long texts to PDF?
Does anyone have a valid download link for this?
Script Reporter-EditedBN_2.livecode
https://sites.google.com/a/pgcps.org/li ... -printouts
[Before anyone jumps: NO, it is only of tangential interest to the original question.]
Script Reporter-EditedBN_2.livecode
https://sites.google.com/a/pgcps.org/li ... -printouts
[Before anyone jumps: NO, it is only of tangential interest to the original question.]