code
New Member
Posts: 30
|
PDF
Mar 19, 2020 10:44:57 GMT -5
Post by code on Mar 19, 2020 10:44:57 GMT -5
nomainwin
button #s, "Download ugly pdf... ", [b], UL, 8, 9
open "" for graphics_nsb as #s
wait
[b]
open "urlmon" for dll as #d
u$ = "http://c-studio.freevar.com/screen.pdf"
r = mkdir("C:\a_ugly_pdf")
f$ = "C:\a_ugly_pdf\screen.pdf"
calldll #d, "URLDownloadToFileA", 0 as long,u$ as struct,f$ as struct,x2 as long,0 as long, result as boolean
b$ = "C:\a_ugly_pdf\screen.pdf"
RUN "rundll32.exe url.dll,FileProtocolHandler ";b$
wait
Regards,
code
|
|
code
New Member
Posts: 30
|
PDF
Mar 19, 2020 10:46:47 GMT -5
Post by code on Mar 19, 2020 10:46:47 GMT -5
nomainwin
button #s, "Download ugly pdf... ", [b], UL, 8, 9
open "" for graphics_nsb as #s
wait
[b]
open "urlmon" for dll as #d
u$ = "http://c-studio.freevar.com/screen.pdf" r = mkdir("C:\a_ugly_pdf") f$ = "C:\a_ugly_pdf\screen.pdf"
calldll #d, "URLDownloadToFileA", 0 as long,u$ as struct,f$ as struct,x2 as long,0 as long, result as boolean
b$ = "C:\a_ugly_pdf\screen.pdf" RUN "rundll32.exe url.dll,FileProtocolHandler ";b$
wait
|
|
|
PDF
Mar 19, 2020 12:08:10 GMT -5
Post by Carl Gundel on Mar 19, 2020 12:08:10 GMT -5
Is that a Rosetta Code item?
|
|
code
New Member
Posts: 30
|
PDF
Mar 19, 2020 12:35:50 GMT -5
Post by code on Mar 19, 2020 12:35:50 GMT -5
Hi,
I 'saw' some websites like Alice restau... and maybe something like Rosetta website ...(Did/Do you mean that?)
Regards,
code
|
|
|
PDF
Mar 19, 2020 12:48:46 GMT -5
Post by Carl Gundel on Mar 19, 2020 12:48:46 GMT -5
|
|
code
New Member
Posts: 30
|
Post by code on Mar 19, 2020 12:55:25 GMT -5
No , did not contribute for that site...
Greetings,
code
|
|
code
New Member
Posts: 30
|
Post by code on May 13, 2020 12:29:54 GMT -5
The url(screen.pdf) doesn't work anymore...
You can make your own ugly .pdf (test.pdf) with the following code(free to use/modify/spread):
nomainwin
WindowWidth=800
WindowHeight=600
button #scr, "Make ugly pdf and run... ", [b1], UL, 550, 500
texteditor #scr.te, 10, 10, 600, 450
open "Ugly pdf..." for graphics_nsb as #scr
print #scr.te, "Type here some text..."
print #scr, "fill darkred"
print #scr, "flush"
wait
[b1]
print #scr.te, "!lines cl" ;
open "test.pdf" for output as #tf
print #tf,"%PDF-1.1"
print #tf,"%????"
print #tf,"1 0 obj"
print #tf,"<<"
print #tf,"/Kids [2 0 R]"
print #tf,"/Type /Pages"
print #tf,"/Count 1"
print #tf,">>"
print #tf,"endobj"
print #tf,"2 0 obj"
print #tf,"<<"
print #tf,"/Rotate 0"
print #tf,"/Parent 1 0 R"
print #tf,"/MediaBox [0 0 792 612]"
print #tf,"/Resources 3 0 R"
print #tf,"/Type /Page"
print #tf,"/Contents [4 0 R]"
print #tf,">>"
print #tf,"endobj"
print #tf,"3 0 obj "
print #tf,"<<"
print #tf,"/Font"
print #tf,"<<"
print #tf,"/F0"
print #tf,"<<"
print #tf,"/BaseFont /Arial"
print #tf,"/Subtype /Type1"
print #tf,"/Type /Font"
print #tf,">>"
print #tf,">>"
print #tf,">>"
print #tf,"endobj "
print #tf,"4 0 obj "
print #tf,"<<"
print #tf,"/Length 121"
print #tf,">>"
print #tf,"stream"
print #tf,"0.5 g"
print #tf,"BT"
print #tf,"/F0 40 Tf"
print #tf,"1 0 0 1 60 550 Tm"
print #tf,"40 TL"
print #tf,"() Tj T*"
for i = 0 to cl step 1
print #scr.te, "!line ";i;" linete$" ;
print #tf,"2 Tr"
print #tf,"(";linete$;") Tj T*"
next i
print #tf,"ET"
print #tf,"0.8 0 0 rg"
print #tf," 10 510 m"
print #tf," 60 510 l"
print #tf," 60 10 l"
print #tf," 10 10 l"
print #tf," f"
print #tf,"endstream"
print #tf,"endobj"
print #tf,"5 0 obj"
print #tf,"<<"
print #tf,"/Pages 1 0 R"
print #tf,"/Type /Catalog"
print #tf,">>"
print #tf,"endobj xref"
print #tf,"0 6"
print #tf,"0000000000 65535 f"
print #tf,"0000000015 00000 n"
print #tf,"0000000074 00000 n"
print #tf,"0000000192 00000 n"
print #tf,"0000000291 00000 n"
print #tf,"0000000466 00000 n"
print #tf,"trailer"
print #tf,""
print #tf,"<<"
print #tf,"/Root 5 0 R"
print #tf,"/Size 6"
print #tf,">>"
print #tf,"startxref"
print #tf,"516"
print #tf,"%%EOF"
close #tf
b$ = "test.pdf"
RUN "rundll32.exe url.dll,FileProtocolHandler ";b$
wait
Upload test.pdf to your website... and change the url in the code... succes!
|
|
|
PDF
May 13, 2020 12:44:23 GMT -5
Post by Carl Gundel on May 13, 2020 12:44:23 GMT -5
You can make your own ugly .pdf (test.pdf) with the following code(free to use/modify/spread): Doesn't this deserve its own thread?
|
|
code
New Member
Posts: 30
|
PDF
May 14, 2020 8:13:54 GMT -5
Post by code on May 14, 2020 8:13:54 GMT -5
Yes , it deserves it The 'mediabox' decides the size of the paper: This is what i have done (with blue font ( print #tf,"0 0 0.9 rg")): (now its long enough...) Goodluck
nomainwin WindowWidth=800 WindowHeight=600
button #scr, "Make ugly pdf and run... ", [b1], UL, 550, 500
texteditor #scr.te, 10, 10, 600, 450
open "Ugly pdf..." for graphics_nsb as #scr print #scr.te, "Type here some text..."
print #scr, "fill darkred" print #scr, "flush"
wait
[b1] print #scr.te, "!lines cl" ;
open "test.pdf" for output as #tf
print #tf,"%PDF-1.1" print #tf,"%????" print #tf,"1 0 obj" print #tf,"<<" print #tf,"/Kids [2 0 R]" print #tf,"/Type /Pages" print #tf,"/Count 1" print #tf,">>" print #tf,"endobj" print #tf,"2 0 obj" print #tf,"<<" print #tf,"/Rotate 0" print #tf,"/Parent 1 0 R" print #tf,"/MediaBox [0 0 792 ";(cl*40)+80;"]" print #tf,"/Resources 3 0 R" print #tf,"/Type /Page" print #tf,"/Contents [4 0 R]" print #tf,">>" print #tf,"endobj" print #tf,"3 0 obj " print #tf,"<<" print #tf,"/Font" print #tf,"<<" print #tf,"/F0" print #tf,"<<" print #tf,"/BaseFont /Arial" print #tf,"/Subtype /Type1" print #tf,"/Type /Font" print #tf,">>" print #tf,">>" print #tf,">>" print #tf,"endobj " print #tf,"4 0 obj " print #tf,"<<" print #tf,"/Length 121" print #tf,">>" print #tf,"stream" print #tf,"0.5 g" print #tf,"0 0 0.9 rg" print #tf,"BT" print #tf,"/F0 40 Tf" print #tf,"1 0 0 1 60 ";(cl*40)+80;" Tm" print #tf,"40 TL" print #tf,"() Tj T*"
for i = 0 to cl step 1 print #scr.te, "!line ";i;" linete$" ;
print #tf,"2 Tr" print #tf,"(";linete$;") Tj T*"
next i
print #tf,"ET"
print #tf,"endstream" print #tf,"endobj" print #tf,"5 0 obj" print #tf,"<<" print #tf,"/Pages 1 0 R" print #tf,"/Type /Catalog" print #tf,">>" print #tf,"endobj xref" print #tf,"0 6" print #tf,"0000000000 65535 f" print #tf,"0000000015 00000 n" print #tf,"0000000074 00000 n" print #tf,"0000000192 00000 n" print #tf,"0000000291 00000 n" print #tf,"0000000466 00000 n" print #tf,"trailer" print #tf,"" print #tf,"<<" print #tf,"/Root 5 0 R" print #tf,"/Size 6" print #tf,">>" print #tf,"startxref" print #tf,"516" print #tf,"%%EOF"
close #tf
b$ = "test.pdf" RUN "rundll32.exe url.dll,FileProtocolHandler ";b$
wait
|
|
code
New Member
Posts: 30
|
PDF
May 15, 2020 15:24:55 GMT -5
Post by code on May 15, 2020 15:24:55 GMT -5
Here another version (with drawing blue lines) :
nomainwin WindowWidth=800 WindowHeight=600
button #scr, "Make ugly pdf and run... ", [b1], UL, 550, 500 button #scr, "Draw lines... ", [b2], UL, 55, 500 texteditor #scr.te, 10, 10, 600, 450
open "Ugly pdf..." for graphics_nsb as #scr
print #scr.te, "Type here some text..." print #scr.te, "" print #scr.te, "" print #scr.te, "" print #scr.te, "" print #scr.te, "" print #scr.te, "" print #scr.te, "" print #scr.te, "" print #scr.te, "" print #scr.te, "" print #scr.te, "" print #scr.te, "" print #scr.te, "...some text..."
print #scr, "fill darkred" print #scr, "flush" fl=0 ln=0 dim x1(900) dim y1(900) dim x2(900) dim y2(900) xp=30 yp=120 wait [d2] print #scr2, "fill white" print #scr2, "flush" for dbl = 0 to fl step 1 print #scr2, "color blue" print #scr2, "line ";x1(dbl);" ";y1(dbl);" ";x2(dbl);" ";y2(dbl);
next dbl if status=1 then print #scr2, "color blue" print #scr2, "line ";x1(ln);" ";y1(ln);" ";MouseX;" ";MouseY; end if wait [d]
status=status+1
if status=2 then fl=fl+1 x2(fl)=MouseX y2(fl)=MouseY
status=0 end if
if status=1 then ln=ln+1 x1(ln)=MouseX y1(ln)=MouseY end if
wait
[b2]
open "Draw blue lines with mousedown..." for graphics_nsb as #scr2
print #scr2, "fill white" print #scr2, "flush" print #scr2, "when leftButtonDown [d]"
print #scr2, "down ; size 1"
print #scr2, "when mouseMove [d2]"
wait [b1] print #scr.te, "!lines cl" ;
open "test.pdf" for output as #tf
print #tf,"%PDF-1.1" print #tf,"%????" print #tf,"1 0 obj" print #tf,"<<" print #tf,"/Kids [2 0 R]" print #tf,"/Type /Pages" print #tf,"/Count 1" print #tf,">>" print #tf,"endobj" print #tf,"2 0 obj" print #tf,"<<" print #tf,"/Rotate 0" print #tf,"/Parent 1 0 R" print #tf,"/MediaBox [0 0 792 ";(cl*20)+40;"]" print #tf,"/Resources 3 0 R" print #tf,"/Type /Page" print #tf,"/Contents [4 0 R]" print #tf,">>" print #tf,"endobj" print #tf,"3 0 obj " print #tf,"<<" print #tf,"/Font" print #tf,"<<" print #tf,"/F0" print #tf,"<<" print #tf,"/BaseFont /Arial" print #tf,"/Subtype /Type1" print #tf,"/Type /Font" print #tf,">>" print #tf,">>" print #tf,">>" print #tf,"endobj " print #tf,"4 0 obj " print #tf,"<<" print #tf,"/Length 121" print #tf,">>" print #tf,"stream" print #tf,"0.5 g" print #tf,"0 0 0 rg" print #tf,"BT" print #tf,"/F0 20 Tf" print #tf,"1 0 0 1 60 ";(cl*20)+40;" Tm" print #tf,"20 TL" print #tf,"() Tj T*"
for i = 0 to cl step 1 print #scr.te, "!line ";i;" linete$" ;
print #tf,"2 Tr" print #tf,"(";linete$;") Tj T*"
next i
print #tf,"ET"
for dl = 1 to fl step 1 print #tf,"0 0 1 rg" print #tf," ";x1(dl)+xp;" ";(cl*20)-y1(dl)+yp;" m" print #tf," ";x2(dl)+xp;" ";(cl*20)-y2(dl)+yp;" l" print #tf," f" next dl
print #tf,"endstream" print #tf,"endobj" print #tf,"5 0 obj" print #tf,"<<" print #tf,"/Pages 1 0 R" print #tf,"/Type /Catalog" print #tf,">>" print #tf,"endobj xref" print #tf,"0 6" print #tf,"0000000000 65535 f" print #tf,"0000000015 00000 n" print #tf,"0000000074 00000 n" print #tf,"0000000192 00000 n" print #tf,"0000000291 00000 n" print #tf,"0000000466 00000 n" print #tf,"trailer" print #tf,"" print #tf,"<<" print #tf,"/Root 5 0 R" print #tf,"/Size 6" print #tf,">>" print #tf,"startxref" print #tf,"516" print #tf,"%%EOF"
close #tf
b$ = "test.pdf" RUN "rundll32.exe url.dll,FileProtocolHandler ";b$
wait
|
|
code
New Member
Posts: 30
|
PDF
May 15, 2020 16:09:11 GMT -5
Post by code on May 15, 2020 16:09:11 GMT -5
To embed test.pdf in html page :
nomainwin WindowWidth=800 WindowHeight=600
button #scr, "Make .html file and run... ", [b1], UL, 550, 500
open "HTML for pdf..." for graphics_nsb as #scr
print #scr, "fill darkgray" print #scr, "flush"
wait
[b1]
open "test.html" for output as #tf
print #tf,"<embed src=test.pdf width=600 height=450 embed>"
close #tf
b$ = "test.html" RUN "rundll32.exe url.dll,FileProtocolHandler ";b$
wait
Regards,
code
|
|