Generating .pdf files with batch?
Moderator: DosItHelp
Re: Generating .pdf files with batch?
Great, Steffen!
Thanks.
Saso
Thanks.
Saso
Re: Generating .pdf files with batch?
Thanks for your feedback, Saso!
For those of you guys who want to see the uncompressed human-readable code I'd like to add it to this thread, too.
Do not use it! It's ~25% slower for lines that contain tabs and still ~10% slower for files that don't contain tabs. ( rather use viewtopic.php?f=3&t=8289&start=15#p55139 )
Steffen
For those of you guys who want to see the uncompressed human-readable code I'd like to add it to this thread, too.
Do not use it! It's ~25% slower for lines that contain tabs and still ~10% slower for files that don't contain tabs. ( rather use viewtopic.php?f=3&t=8289&start=15#p55139 )
Steffen
- Attachments
-
- txt2pdf_long.zip
- (2.41 KiB) Downloaded 596 times
Re: Generating .pdf files with batch?
einstein1969 posted a version which is both readable and fast. Thanks!
viewtopic.php?p=67779#p67779
Steffen
viewtopic.php?p=67779#p67779
Steffen
- Attachments
-
- txt2pdf_einstein.zip
- (2.44 KiB) Downloaded 331 times
Re: Generating .pdf files with batch?
Wow! Great! Thanks to you both! Works great. Of course there is still a problem with our national characters. Steffen: do your umlaut letters for example get enconded successfully?
Saso
Saso
Re: Generating .pdf files with batch?
I've been never able to get around the limitation of supporting Windows-1252 only. That's kind of the default for PDF. I don't know how to get Unicode support, sorry.
Steffen
Steffen
Re: Generating .pdf files with batch?
Yes, PDF specification says that special characters should be embedded (fonts I think). Not easy to do.
Anyway. Einstein's solution is great, too.
Thanks.
Saso
Anyway. Einstein's solution is great, too.
Thanks.
Saso
-
- Expert
- Posts: 960
- Joined: 15 Jun 2012 13:16
- Location: Italy, Rome
Re: Generating .pdf files with batch?
This version on my system passed from 43sec to 11sec (4X)
I have insert the subs inline and changed the strlen into macro faster version
I have insert the subs inline and changed the strlen into macro faster version
- Attachments
-
- test.zip
- (41.59 KiB) Downloaded 371 times
-
- Expert
- Posts: 960
- Joined: 15 Jun 2012 13:16
- Location: Italy, Rome
Re: Generating .pdf files with batch?
there is a very strange thing, you can check that you have more experience.
if I transform the tab_iter into this:
and I insert it in the block with the set / P (I avoid the CALL) the execution time of the batch doubles! I do not understand why'....
if I transform the tab_iter into this:
Code: Select all
set i=0
For /L %%. in (1,1,1250) do (
if !i! lss !len! (
set /a "nxt=!i!+1"
for %%I in (!i!) do (
if "!ln:~%%I,1!"=="%tab%" (
set /a "d=0-(%%I %% tabWidth)+tabWidth, e=nxt, nxt+=d-1, len+=d-1"
for /f "tokens=1,2" %%D in ("!d! !e!") do set "ln=!ln:~0,%%I!!spcs:~0,%%D!!ln:~%%E!"
)
)
set /a i=nxt
)
)
-
- Expert
- Posts: 960
- Joined: 15 Jun 2012 13:16
- Location: Italy, Rome
Re: Generating .pdf files with batch?
last version. I have inline strlen. Last code 8sec on my laptop
Code: Select all
short code
Elapsed 76 sec.
long code
Elapsed 96 sec.
einstein code
Elapsed 42 sec.
einstein code 2
Elapsed 15 sec.
long code (einstein latest)
Elapsed 15 sec.
long code (einstein latest 2)
Elapsed 9 sec.
long code (einstein latest 3)
Elapsed 8 sec.
Premere un tasto per continuare . . .
- Attachments
-
- 2pdf.zip
- (93.91 KiB) Downloaded 377 times
-
- Expert
- Posts: 960
- Joined: 15 Jun 2012 13:16
- Location: Italy, Rome
Re: Generating .pdf files with batch?
I understand why: it is called thousands of times and actually did about 1000 * 1000 if uselesseinstein1969 wrote: ↑23 Oct 2022 12:50there is a very strange thing, you can check that you have more experience.
if I transform the tab_iter into this:and I insert it in the block with the set / P (I avoid the CALL) the execution time of the batch doubles! I do not understand why'....Code: Select all
set i=0 For /L %%. in (1,1,1250) do ( if !i! lss !len! ( set /a "nxt=!i!+1" for %%I in (!i!) do ( if "!ln:~%%I,1!"=="%tab%" ( set /a "d=0-(%%I %% tabWidth)+tabWidth, e=nxt, nxt+=d-1, len+=d-1" for /f "tokens=1,2" %%D in ("!d! !e!") do set "ln=!ln:~0,%%I!!spcs:~0,%%D!!ln:~%%E!" ) ) set /a i=nxt ) )
-
- Expert
- Posts: 960
- Joined: 15 Jun 2012 13:16
- Location: Italy, Rome
Re: Generating .pdf files with batch?
there was a wrong version in the zip I corrected and redid the tests. last version 10X
Code: Select all
short code
Elapsed 83 sec.
long code
Elapsed 95 sec.
einstein code
Elapsed 44 sec.
einstein code 2
Elapsed 15 sec.
long code (einstein latest)
Elapsed 11 sec.
long code (einstein latest 2)
Elapsed 9 sec.
long code (einstein latest 3)
Elapsed 8 sec.
- Attachments
-
- 2pdf.zip
- (106.95 KiB) Downloaded 352 times
-
- Expert
- Posts: 960
- Joined: 15 Jun 2012 13:16
- Location: Italy, Rome
Re: Generating .pdf files with batch?
I have made further progress.
I calculated the maximum expansion of the tabs and brought the tab_iter into the main loop. No more while..do / repeat..until loops
I have minimized the Sets and the calls to the strlen.
I have added comments
doubled the size of the txt, now it's 646KB.
Execution time dropped by 20% since last code. From 200 sec to 16 sec on my laptop. 13X
have a coffee during the tests ...
the fastest version is "txt2pdf_long5.bat"
I calculated the maximum expansion of the tabs and brought the tab_iter into the main loop. No more while..do / repeat..until loops
I have minimized the Sets and the calls to the strlen.
I have added comments
doubled the size of the txt, now it's 646KB.
Execution time dropped by 20% since last code. From 200 sec to 16 sec on my laptop. 13X
have a coffee during the tests ...
Code: Select all
short code
Elapsed 206.4 sec.
long code
Elapsed 222.9 sec.
einstein code
Elapsed 127.8 sec.
Code: Select all
einstein code 2
Elapsed 37.8 sec.
long code (einstein latest)
Elapsed 23.5 sec.
long code (einstein latest 2)
Elapsed 21.0 sec.
long code (einstein latest 3)
Elapsed 19.6 sec.
long code (einstein latest 4)
Elapsed 16.0 sec.
- Attachments
-
- 2pdf.zip
- (175.04 KiB) Downloaded 356 times
Re: Generating .pdf files with batch?
Thanks! Will check.
In the mean time I checked the .pdf reference again. I still don't have a solution to embed a font (only characters I need) to the .pdf. Maybe one day.
Saso
In the mean time I checked the .pdf reference again. I still don't have a solution to embed a font (only characters I need) to the .pdf. Maybe one day.
Saso