Pagina 1 van 1

Lelijke pdf file..

BerichtGeplaatst: wo dec 16, 2015 7:01 pm
door FrederikPot
Auw, dat kostte toch weer even moeite om justbasic te leren.
Hierbij een simpele code om een pdf file te genereren.
Het doet/geeft een kerstwens/nieuwjaar groet.
Je zou het verder kunnen ontwikkelen...

Groeten,

Frederik Pot


Code: Selecteer alles



WindowWidth=280
WindowHeight=200
nomainwin

button #scr, "   Show  pdf file in browser...", [b1], UL, 5, 40

open "Make ugly pdf file..." for graphics_nsb as #scr
print #scr, "trapclose [exit]"
print #scr, "fill darkred"



wait

[b1]





open "text.pdf" for output as #tf

print #tf, "%PDF-1.1"
print #tf, "%¥±ë"

print #tf, "1 0 obj"
print #tf, "  << /Type /Catalog"
print #tf, "     /Pages 2 0 R"
print #tf, "  >>"
print #tf, "endobj"
print #tf, " "
print #tf, "2 0 obj"
print #tf, "  << /Type /Pages"
print #tf, "     /Kids [3 0 R]"
print #tf, "     /Count 1"
print #tf, "     /MediaBox [0 0 300 620]"
print #tf, " "
print #tf, "  >>"
print #tf, "endobj"
print #tf, " "
print #tf, "3 0 obj"
print #tf, "  <<  /Type /Page"
print #tf, "      /Parent 2 0 R"
print #tf, "      /Resources"
print #tf, "     << /Font"
print #tf, "           << /F2"
print #tf, "               << /Type /Font"
print #tf, "                  /Subtype /Type1"
print #tf, "                  /BaseFont /Arial"
print #tf, "               >>"
print #tf, "           >>"
print #tf, "       >>"
print #tf, "      /Contents 4 0 R"
print #tf, " >>"
print #tf, "endobj"
print #tf, " "
print #tf, "4 0 obj"
print #tf, "  << /Length 55 >>"
print #tf, " "
print #tf, " "
print #tf, "stream"
print #tf," "
print #tf,"BT"
print #tf,"    /F2 10 Tf"
print #tf,"    10 600 Td"
print #tf,"    (Prettige Kerstdagen) Tj"
print #tf," "
print #tf," "
print #tf," "
print #tf,"  ET"
print #tf," "

print #tf," "
print #tf,"BT"
print #tf,"    /F2 10 Tf"
print #tf,"    10 590 Td"
print #tf,"    (& een Gelukkig Nieuwjaar !) Tj"
print #tf," "
print #tf," "
print #tf," "
print #tf,"  ET"
print #tf," "

print #tf,"endstream"
print #tf,"endobj"
print #tf," "
print #tf," "
print #tf," "
print #tf,"xref"
print #tf,"0 5"
print #tf,"0000000000 65535 f "
print #tf,"0000000018 00000 n "
print #tf,"0000000077 00000 n "
print #tf,"0000000178 00000 n "
print #tf,"0000000457 00000 n "
print #tf,"trailer"
print #tf,"  <<  /Root 1 0 R"
print #tf,"      /Size 5"
print #tf,"  >>"
print #tf,"startxref"
print #tf,"565"
print #tf,"%%EOF"

close #tf













run "explorer.exe text.pdf"

wait
[exit]
   close #scr