|
|
@ -16,7 +16,7 @@
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 81,
|
|
|
|
"execution_count": null,
|
|
|
|
"metadata": {},
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"source": [
|
|
|
@ -26,7 +26,7 @@
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 87,
|
|
|
|
"execution_count": null,
|
|
|
|
"metadata": {},
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"source": [
|
|
|
@ -35,81 +35,11 @@
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 88,
|
|
|
|
"execution_count": null,
|
|
|
|
"metadata": {},
|
|
|
|
"metadata": {
|
|
|
|
"outputs": [
|
|
|
|
"scrolled": true
|
|
|
|
{
|
|
|
|
},
|
|
|
|
"name": "stdout",
|
|
|
|
"outputs": [],
|
|
|
|
"output_type": "stream",
|
|
|
|
|
|
|
|
"text": [
|
|
|
|
|
|
|
|
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n",
|
|
|
|
|
|
|
|
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n",
|
|
|
|
|
|
|
|
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n",
|
|
|
|
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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n",
|
|
|
|
|
|
|
|
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n",
|
|
|
|
|
|
|
|
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n",
|
|
|
|
|
|
|
|
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n",
|
|
|
|
|
|
|
|
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n",
|
|
|
|
|
|
|
|
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n",
|
|
|
|
|
|
|
|
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n",
|
|
|
|
|
|
|
|
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n",
|
|
|
|
|
|
|
|
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n"
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
"source": [
|
|
|
|
"source": [
|
|
|
|
"# Simple fill-up of a page, to set the reach of our canvas\n",
|
|
|
|
"# Simple fill-up of a page, to set the reach of our canvas\n",
|
|
|
|
"lines = [] # All the lines will be stored here\n",
|
|
|
|
"lines = [] # All the lines will be stored here\n",
|
|
|
@ -129,7 +59,7 @@
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"source": [
|
|
|
|
"# Another variation\n",
|
|
|
|
"# Another way to fill-up the page\n",
|
|
|
|
"import random \n",
|
|
|
|
"import random \n",
|
|
|
|
"\n",
|
|
|
|
"\n",
|
|
|
|
"lines = []\n",
|
|
|
|
"lines = []\n",
|
|
|
@ -149,14 +79,17 @@
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 90,
|
|
|
|
"execution_count": null,
|
|
|
|
"metadata": {},
|
|
|
|
"metadata": {
|
|
|
|
|
|
|
|
"scrolled": true
|
|
|
|
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"source": [
|
|
|
|
"# Same variation, but with multiple pages\n",
|
|
|
|
"# Same as above + a \"switch\" to make multipaged PDFs\n",
|
|
|
|
"import random \n",
|
|
|
|
"import random \n",
|
|
|
|
"\n",
|
|
|
|
"\n",
|
|
|
|
"multipage = True\n",
|
|
|
|
"multipage = True\n",
|
|
|
|
|
|
|
|
"number_of_pages = 100\n",
|
|
|
|
"\n",
|
|
|
|
"\n",
|
|
|
|
"lines = []\n",
|
|
|
|
"lines = []\n",
|
|
|
|
"pages = []\n",
|
|
|
|
"pages = []\n",
|
|
|
@ -164,7 +97,7 @@
|
|
|
|
"txt = open('txt/language.txt', 'r').read()\n",
|
|
|
|
"txt = open('txt/language.txt', 'r').read()\n",
|
|
|
|
"words = txt.split()\n",
|
|
|
|
"words = txt.split()\n",
|
|
|
|
"\n",
|
|
|
|
"\n",
|
|
|
|
"for page in range(100):\n",
|
|
|
|
"for page in range(number_of_pages):\n",
|
|
|
|
" \n",
|
|
|
|
" \n",
|
|
|
|
" for linenumber in range(height):\n",
|
|
|
|
" for linenumber in range(height):\n",
|
|
|
|
" word = random.choice(words)\n",
|
|
|
|
" word = random.choice(words)\n",
|
|
|
@ -176,7 +109,10 @@
|
|
|
|
" # Add a page\n",
|
|
|
|
" # Add a page\n",
|
|
|
|
" pages.append(lines)\n",
|
|
|
|
" pages.append(lines)\n",
|
|
|
|
" lines = []\n",
|
|
|
|
" lines = []\n",
|
|
|
|
" "
|
|
|
|
"\n",
|
|
|
|
|
|
|
|
"for page in pages:\n",
|
|
|
|
|
|
|
|
" print('\\n'.join(page))\n",
|
|
|
|
|
|
|
|
" print('-' * width)"
|
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -209,7 +145,7 @@
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 91,
|
|
|
|
"execution_count": null,
|
|
|
|
"metadata": {},
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"source": [
|
|
|
@ -220,7 +156,7 @@
|
|
|
|
"pagewidth = 210*mm\n",
|
|
|
|
"pagewidth = 210*mm\n",
|
|
|
|
"pageheight = 297*mm\n",
|
|
|
|
"pageheight = 297*mm\n",
|
|
|
|
"\n",
|
|
|
|
"\n",
|
|
|
|
"c = Canvas(\"pdf/ASCII-canvas-to-PDF.pdf\", pagesize=(pagewidth, pageheight), bottomup=0)\n",
|
|
|
|
"c = Canvas(\"ASCII-canvas-to-PDF.pdf\", pagesize=(pagewidth, pageheight), bottomup=0)\n",
|
|
|
|
"c.setFont('Courier', 12)\n",
|
|
|
|
"c.setFont('Courier', 12)\n",
|
|
|
|
"\n",
|
|
|
|
"\n",
|
|
|
|
"start_y = 10*mm # start position of the lines\n",
|
|
|
|
"start_y = 10*mm # start position of the lines\n",
|
|
|
@ -242,13 +178,6 @@
|
|
|
|
" \n",
|
|
|
|
" \n",
|
|
|
|
"c.save()"
|
|
|
|
"c.save()"
|
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
|
|
|
"execution_count": null,
|
|
|
|
|
|
|
|
"metadata": {},
|
|
|
|
|
|
|
|
"outputs": [],
|
|
|
|
|
|
|
|
"source": []
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
],
|
|
|
|
"metadata": {
|
|
|
|
"metadata": {
|
|
|
|