itextsharp pdf to image c# example : Create a form in pdf from word application Library utility html .net web page visual studio Automate%20the%20Boring%20Stuff%20with%20Python%20(2015)48-part1639

Answers to the Practice Questions
457
7. 
docx.Document('demo.docx')
8.  A document contains multiple paragraphs. A paragraph begins on a 
new line and contains multiple runs. Runs are contiguous groups of 
characters within a paragraph.
9.  Use 
doc.paragraphs
.
10.  A 
Run
object has these variables (not a Paragraph).
11. 
True
always makes the 
Run
object bolded and 
False
makes it always not 
bolded, no matter what the style’s bold setting is. 
None
will make the 
Run
object just use the style’s bold setting.
12.  Call the 
docx.Document()
function.
13. 
doc.add_paragraph('Hello there!')
14.  The integers 
0
1
2
3
, and 
4
chapter 14
1.  In Excel, spreadsheets can have values of data types other than strings; 
cells can have different fonts, sizes, or color settings; cells can have 
varying widths and heights; adjacent cells can be merged; and you can 
embed images and charts.
2.  You pass a 
File
object, obtained from a call to 
open()
.
3. 
File
objects need to be opened in read-binary (
'rb'
) for 
Reader
objects 
and write-binary (
'wb'
) for 
Writer
objects.
4.  The 
writerow()
method
5.  The 
delimiter
argument changes the string used to separate cells 
in a row. The 
lineterminator
argument changes the string used to 
separate rows.
6. 
json.loads()
7. 
json.dumps()
chapter 15
1.  A reference moment that many date and time programs use. The 
moment is January 1st, 1970, UTC.
2. 
time.time()
3. 
time.sleep(5)
4.  It returns the closest integer to the argument passed. For example, 
round(2.4)
returns 
2
.
5.  A 
datetime
object represents a specific moment in time. A 
timedelta
object represents a duration of time.
6. 
threadObj = threading.Thread(target=spam)
7. 
threadObj.start()
Create a form in pdf from word - C# PDF Field Edit Library: insert, delete, update pdf form field in C#.net, ASP.NET, MVC, Ajax, WPF
Online C# Tutorial to Insert, Delete and Update Fields in PDF Document
add form fields to pdf; pdf form maker
Create a form in pdf from word - VB.NET PDF Field Edit library: insert, delete, update pdf form field in vb.net, ASP.NET, MVC, Ajax, WPF
How to Insert, Delete and Update Fields in PDF Document with VB.NET Demo Code
create a pdf form from excel; change font pdf form
458   
Appendix C
8.  Make sure that code running in one thread does not read or write the 
same variables as code running in another thread.
9. 
subprocess.Popen('c:\\Windows\\System32\\calc.exe')
chapter 16
1.  SMTP and IMAP, respectively
2. 
smtplib.SMTP()
smtpObj.ehlo()
smptObj.starttls()
, and 
smtpObj.login()
3. 
imapclient.IMAPClient()
and 
imapObj.login()
4.  A list of strings of IMAP keywords, such as 
'BEFORE <date>'
'FROM 
<string>'
, or 
'SEEN'
5.  Assign the variable 
imaplib._MAXLINE
a large integer value, such as 
10000000
.
6.  The 
pyzmail
module reads downloaded emails.
7.  You will need the Twilio account SID number, the authentication token 
number, and your Twilio phone number.
chapter 17
1.  An RGBA value is a tuple of 4 integers, each ranging from 0 to 255. The 
four integers correspond to the amount of red, green, blue, and alpha 
(transparency) in the color.
2.  A function call to 
ImageColor.getcolor('CornflowerBlue', 'RGBA')
will 
return 
(100, 149, 237, 255)
, the RGBA value for that color.
3.  A box tuple is a tuple value of four integers: the left edge x-coordinate, 
the top edge y-coordinate, the width, and the height, respectively.
4. 
Image.open('zophie.png')
5. 
imageObj.size
is a tuple of two integers, the width and the height.
6. 
imageObj.crop((0, 50, 50, 50))
. Notice that you are passing a box tuple to 
crop()
, not four separate integer arguments.
7.  Call the 
imageObj.save('new_filename.png')
method of the 
Image
object.
8.  The 
ImageDraw
module contains code to draw on images.
9. 
ImageDraw
objects have shape-drawing methods such as 
point()
line()
or 
rectangle()
. They are returned by passing the 
Image
object to the 
ImageDraw.Draw()
function.
chapter 18
1.  Move the mouse to the top-left corner of the screen, that is, the (0, 0) 
coordinates.
2. 
pyautogui.size()
returns a tuple with two integers for the width and 
height of the screen.
VB.NET Create PDF from Word Library to convert docx, doc to PDF in
C#: Create PDF from PowerPoint; C#: Create PDF from Tiff; C#: Convert PDF to Word; C#: Convert PDF to C# Protect: Add Password to PDF; C# Form: extract value
change font size in fillable pdf form; allow saving of pdf form
C# Create PDF from Word Library to convert docx, doc to PDF in C#.
Create PDF from Word. |. Home ›› XDoc.PDF ›› C# PDF: Create PDF from Word. Easy to create searchable and scanned PDF files from Word.
add fillable fields to pdf online; changing font size in pdf form
Answers to the Practice Questions
459
3. 
pyautogui.position()
returns a tuple with two integers for the x- and 
y-coordinates of the mouse cursor.
4.  The 
moveTo()
function moves the mouse to absolute coordinates on the 
screen, while the 
moveRel()
function moves the mouse relative to the 
mouse’s current position.
5. 
pyautogui.dragTo()
and 
pyautogui.dragRel()
6. 
pyautogui.typewrite('Hello world!')
7.  Either pass a list of keyboard key strings to 
pyautogui.typewrite()
(such 
as 
'left'
) or pass a single keyboard key string to 
pyautogui.press()
.
8. 
pyautogui.screenshot('screenshot.png')
9. 
pyautogui.PAUSE = 2
VB.NET PDF Convert to Word SDK: Convert PDF to Word library in vb.
webpage. Create high quality Word documents from both scanned PDF and searchable PDF files without losing formats in VB.NET. Support
add text field to pdf acrobat; adding images to pdf forms
VB.NET PDF Form Data Read library: extract form data from PDF in
RasterEdge .NET PDF SDK is such one provide various of form field edit functions. Demo Code to Retrieve All Form Fields from a PDF File in VB.NET.
create a fillable pdf form online; android edit pdf forms
C# PDF Form Data Read Library: extract form data from PDF in C#.
A best PDF document SDK library enable users abilities to read and extract PDF form data in Visual C#.NET WinForm and ASP.NET WebForm applications.
adding text to a pdf form; pdf editable fields
VB.NET Create PDF from PowerPoint Library to convert pptx, ppt to
C#: Create PDF from PowerPoint; C#: Create PDF from Tiff; C#: Convert PDF to Word; C#: Convert PDF to C# Protect: Add Password to PDF; C# Form: extract value
adding a text field to a pdf; best way to make pdf forms
Symbols
=
(assignment) operator, 18, 34
\
(backslash), 124, 151, 162, 174–175
line continuation character, 93
^
(caret symbol), 162
matching beginning of string, 
159–160
negative character classes, 159
:
(colon), 38, 45, 54, 82, 127
{}
(curly brackets), 105, 162
greedy vs. nongreedy matching, 
156–157
matching specific repetitions 
with, 156
$
(dollar sign), 159–160, 162
.
(dot character), 160–162
using in paths, 175–176
wildcard matches, 160–162
"
(double quotes), 124
**
(exponent) operator, 15
==
(equal to) operator, 33, 34
/
(forward slash), 174–175
division operator, 15, 88
>
(greater than) operator, 33
>=
(greater than or equal to) 
operator, 33
#
(hash character), 126
//
(integer division/floored quotient) 
operator, 15
<
(less than) operator, 33
<=
(less than or equal to) operator, 33
%
(modulus/remainder) operator, 
15, 88
*
(multiplication) operator, 15, 83, 88
!=
(not equal to) operator, 33
()
(parentheses), 96–97, 152–153
|
(pipe character), 153–154, 164–165
+
(plus sign), 155–156, 162
addition operator, 15, 17, 83, 88
?
(question mark), 154–155, 162
'
(single quote), 124
[]
(square brackets), 80, 162
*
(star), 162
using with wildcard character, 161
zero or more matches with, 155
-
(subtraction) operator, 15, 88
'''
(triple quotes), 125, 164
_
(underscore), 20
A
%A
directive, 344
%a
directive, 344
absolute paths, 175–179
abspath()
function, 177
addition (
+
) operator, 15, 17, 83, 88
additive color model, 389
add_heading()
method, 314
addPage()
method, 299
add_paragraph()
method, 313–314
add_picture()
method, 315
add_run()
method, 313–314
algebraic chess notation, 112–113
all_caps
attribute, 311
ALL
search key, 369
alpha, defined, 388
and
operator, 35
ANSWERED
search key, 370
API (application programming 
interface), 327–328
append()
method, 89–90
application-specific passwords, 365
args
keyword, 349
arguments, function, 23, 63
keyword arguments, 65–66
passing to processes, 354
passing to threads, 348–349
assertions, 219–221
disabling, 445
assignment (
=
) operator, 18, 34
AT&T mail, 363, 367
attributes, HTML, 241, 248
augmented assignment operators, 
88–89
In d e x
VB.NET Create PDF from Excel Library to convert xlsx, xls to PDF
C#: Create PDF from PowerPoint; C#: Create PDF from Tiff; C#: Convert PDF to Word; C#: Convert PDF to C# Protect: Add Password to PDF; C# Form: extract value
acrobat create pdf form; adding an image to a pdf form
C# PDF Convert to Word SDK: Convert PDF to Word library in C#.net
and .docx. Create editable Word file online without email. Password protected PDF file can be printed to Word for mail merge. C# source
create a pdf form that can be filled out; pdf add signature field
462
Index
B
\b
backspace escape character, 419
%B
directive, 344
%b
directive, 344
back()
method, 261
backslash (
\
), 124, 151, 162, 174–175
BarChart()
function, 290
basename()
function, 178
BCC
search key, 370
Beautiful Soup, 245. See also 
bs4
module
BeautifulSoup
objects, 245–246
BEFORE
search key, 369
binary files, 180–181, 184–185
binary operators, 35–37
bitwise or operator, 164–165
blank strings, 17
blocking execution, 337
blocks of code, 37–38
BODY
search key, 369
bold
attribute, 311
Boolean data type
binary operators, 35–36
flow control and, 32–33
in
operator, 87
not in
operator, 87
“truthy” and “falsey” values, 53
using binary and comparison 
operators together, 36–37
box tuples, 390
breakpoints, debugging using, 229–231
break
statements
overview, 49–50
using in for loop, 55
browser, opening using 
webbrowser
module, 234–236
bs4
module
creating object from HTML, 
245–246
finding element with 
select()
method, 246–247
getting attribute, 248
overview, 245
built-in functions, 57
bulleted list, creating in Wiki markup, 
139–141
copying and pasting clipboard, 
139–140
joining modified lines, 141
overview, 139
separating lines of text, 140
C
calling functions, 23
call stack, defined, 217
camelcase, 21
caret symbol (
^
), 162
matching beginning of string, 
159–160
negative character classes, 159
Cascading Style Sheets (CSS)
matching with 
selenium
module, 258
selectors, 246–247
case sensitivity, 21, 163
CC
search key, 370
Cell
objects, 268–269
cells, in Excel spreadsheets, 266
accessing 
Cell
object by its name, 
268–269
merging and unmerging, 286–287
writing values to, 278–279
center()
method, 133–134, 426
chaining method calls, 398
character classes, 158–159, 162
character styles, 310
charts, Excel, 288–290
chdir()
function, 175
Chrome, developer tools in, 242–243
clear()
method, 258
click()
function, 420, 430, 431
clicking mouse, 420
click()
method, 259
clipboard, using string from, 236
CMYK color model, 389
colon (
:
), 38, 45, 54, 82, 127
color values
CMYK vs. RGB color models, 389
RGBA values, 388–389
column_index_from_string()
function, 270
columns, in Excel spreadsheets
setting height and width of, 
285–286
slicing 
Worksheet
objects to get 
Cell
objects in, 270–272
Comcast mail, 363, 367
comma-delimited items, 80
command line arguments, 235
commentAfterDelay()
function, 429
comments
multiline, 126
overview, 23
VB.NET PDF Convert to Tiff SDK: Convert PDF to tiff images in vb.
Qualified Tiff files are exported with high resolution in VB.NET. Create multipage Tiff image files from PDF in VB.NET project. Support
pdf form change font size; add text field pdf
C# Create PDF from Excel Library to convert xlsx, xls to PDF in C#
C#.NET PDF SDK- Create PDF from Word in Visual C#. Online C#.NET Tutorial for Create PDF from Microsoft Office Excel Spreadsheet Using .NET XDoc.PDF Library.
add fields to pdf form; pdf form save in reader
Index
463
comparison operators
overview, 33–35
using binary operators with, 36–37
compile()
function, 151, 152, 164–165
compressed files
backing up folder into, 209–212
creating ZIP files, 205–206
extracting ZIP files, 205
overview, 203–204
reading ZIP files, 204
computer screen
coordinates of, 415
resolution of, 416
concatenation
of lists, 83
string, 17–18
concurrency issues, 349
conditions, defined, 37
continue
statements
overview, 50–53
using in 
for
loop, 55
Coordinated Universal Time (UTC), 336
coordinates 
of computer screen, 415
of an image, 389–390
copy()
function, 100–101, 135, 198, 394
copytree()
function, 198–199
countdown project, 357–358
counting down, 357
overview, 357
playing sound file, 357–358
cProfile.run()
function, 337
crashes, program, 14
create_sheet()
method, 278
CRITICAL
level, 224
cron, 354
cropping images, 393–394
CSS (Cascading Style Sheets)
matching with 
selenium
module, 258
selectors, 246–247
CSV files
defined, 319
delimeter for, 324
format overview, 320
line terminator for, 324
Reader
objects, 321
reading data in loop, 322
removing header from, 324–327
looping through CSV files, 325
overview, 324–325
reading in CSV file, 325–326
writing out CSV file, 326–327
Writer
objects, 322–323
curly brackets (
{}
), 105, 162
greedy vs. nongreedy matching, 
156–157
matching specific repetitions 
with, 156
current working directory, 175
D
\D
character class, 158
\d
character class, 158
%d
directive, 344
data structures
algebraic chess notation, 112–113
tic-tac-toe board, 113–117
data types
Booleans, 32
defined, 16
dictionaries, 105–106
floating-point numbers, 17
integers, 17
list()
function, 97
lists, 80
mutable vs. immutable, 94–96
None
value, 65
strings, 17
tuple()
function, 97
tuples, 96–97
datetime
module
arithmetic using, 343
converting objects to strings, 
344–345
converting strings to objects, 345
fromtimestamp()
function, 341
now()
function, 341
overview, 341–342, 346
pausing program until time, 344
timedelta
data type, 342–343
total_seconds()
method, 342
datetime
objects, 341–342
converting to strings, 344–345
converting from strings to, 345
debug()
function, 222
debugging
assertions, 219–221
defined, 4
getting traceback as string, 217–218
in IDLE
overview, 225–227
stepping through program, 
227–229
using breakpoints, 229–231
464
Index
debugging (continued)
logging
disabling, 224–225
to file, 225
levels of, 223–224
logging
module, 221–223
print()
function and, 223
raising exceptions, 216–217
DEBUG
level, 223
decimal numbers. See floating-point 
numbers
decode()
method, 374–375
decryption, of PDF files, 297–298
deduplicating code, 62
deepcopy()
function, 100–101
def
statements, 62
with parameters, 63
DELETED
search key, 370
delete_messages()
method, 375
deleting files/folders
permanently, 200–201
using 
send2trash
module, 201–202
del
statements, 84
dictionaries
copy()
function, 100–101
deepcopy()
function, 100–101
get()
method, 109
in
operator, 109
items()
method, 107–108
keys()
method, 107–108
lists vs., 106–107
nesting, 117–119
not in
operator, 109
overview, 105–106
setdefault()
method, 110–111
values()
method, 107–108
directories
absolute vs. relative paths, 175–176
backslash vs. forward slash, 174–175
copying, 198–199
creating, 176
current working directory, 175
defined, 173–174
deleting permanently, 200–201
deleting using 
send2trash
module, 
201–202
moving, 199–200
os.path
module
absolute paths in, 177–179
file sizes, 179–180
folder contents, 179–180
overview, 177
path validity, 180
relative paths in, 177–179
renaming, 199–200
walking, 202–203
dirname()
function, 178
disable()
function, 224
division (
/
) operator, 15, 88
Document
objects, 307–308
dollar sign (
$
), 159–160, 162
dot character (
.
), 160–162
using in paths, 175–176
wildcard matches, 160–162
dot-star character (
.*
), 161
doubleClick()
function, 420, 430
double quotes (
"
), 124
double_strike
attribute, 311
downloading
files from web, 239–240
web pages, 237–238
XKCD comics, 251–256, 350–352
DRAFT
search key, 370
dragging mouse, 420–422
dragRel()
function, 420, 422, 430
dragTo()
function, 420, 430
drawing on images
ellipses, 407
example program, 407–408
ImageDraw
module, 406
lines, 406–407
points, 406
polygons, 407
rectangles, 407
text, 408–410
dumps()
function, 329
duration
keyword arguments, 416
E
ehlo()
method, 364, 379
elements, HTML, 240
elif
statements, 40–45
ellipse()
method, 407
else
statements, 39–40
email addresses, extracting, 165–169
creating regex, 166–167
finding matches on clipboard, 
167–168
joining matches into a string, 168
overview, 165–166
emails
deleting, 375
disconnecting from server, 375–376
fetching
Index
465
folders, 368–369
getting message content, 
372–373
logging into server, 368
overview, 366–367
raw messages, 373–375
gmail_search()
method, 372
IMAP, 366
marking message as read, 372–373
searching, 368–371
sending
connecting to SMTP server, 
363–364
disconnecting from server, 366
logging into server, 364–365
overview, 362
reminder, 376–380
sending “hello” message, 364
sending message, 365
TLS encryption, 364
SMTP, 362
emboss
attribute, 311
encryption, of PDF files, 302–303
endswith()
method, 131
epoch timestamps, 336, 341, 346
equal to (
==
) operator, 33, 34
ERROR
level, 224
errors
crashes and, 14
help for, 8–9
escape characters, 124–125
evaluation, defined, 14
Excel spreadsheets
application support, 265–266
charts in, 288–290
column width, 285–286
converting between column letters 
and numbers, 270
creating documents, 277
creating worksheets, 278
deleting worksheets, 278
font styles, 282–284
formulas in, 284–285
freezing panes, 287–288
getting cell values, 268–269
getting rows and columns, 270–272
getting worksheet names, 268
merging and unmerging cells, 
286–287
opening documents, 267
openpyxl
module, 266
overview, 266–267
reading files
overview, 272–273
populating data structure, 
274–275
reading data, 273–274
writing results to file, 275–276
and reminder emails project, 
376–380
row height, 285–286
saving workbooks, 277
updating, 279–281
overview, 279–280
setup, 280
workbooks vs., 266
writing values to cells, 278–279
Exception
objects, 217
exceptions
assertions and, 219–221
getting traceback as string, 217–218
handling, 72–74
raising, 216–217
execution, program
defined, 31
overview, 38
pausing until specific time, 344
terminating program with  
sys.exit()
, 58
exists()
function, 180
exit codes, 353–354
expand
keyword, 398
exponent (
**
) operator, 15
expressions
conditions and, 37
in interactive shell, 14–16
expunge()
method, 375
extensions, file, 173
extractall()
method, 205
extracting ZIP files, 205
extract()
method, 205
F
FailSafeException
exception, 434
“falsey” values, 53
fetch()
method, 371, 372–373
file editor, 21
file management
absolute vs. relative paths, 175–176
backslash vs. forward slash, 174–175
compressed files
backing up to, 209–212
creating ZIP files, 205–206
466
Index
file management (continued)
compressed files (continued)
extracting ZIP files, 205
overview, 203–204
reading ZIP files, 204
creating directories, 176
current working directory, 175
multiclipboard project, 191–193
opening files, 181–182
os.path
module
absolute paths in, 177–179
file sizes, 179–180
folder contents, 179–180
overview, 177
path validity, 180
relative paths in, 177–179
overview, 173–174
paths, 173–174
plaintext vs. binary files, 180–181
reading files, 182–183
renaming files, date styles, 206–209
saving variables with 
pformat()
function, 185–186
send2trash
module, 201–202
shelve module, 184–185
shutil
module
copying files/folders, 198–199
deleting files/folders, 200–201
moving files/folders, 199–200
renaming files/folders, 199–200
walking directory trees, 202–203
writing files, 183–184
filenames, defined, 173
File
objects, 182
findall()
method, 157–158
find_element_by_*
methods, 257–258
find_elements_by_*
methods, 257–258
Firefox, developer tools in, 243
FLAGGED
search key, 370
flipping images, 398–399
float()
function, 25–28
floating-point numbers
integer equivalence, 27
overview, 17
rounding, 338
flow control
binary operators, 35–36
blocks of code, 37–38
Boolean values and, 32–33
break
statements, 49–50
comparison operators, 33–35
conditions, 37
continue
statements, 50–53
elif
statements, 40–45
else
statements, 39–40
if
statements, 38–39
overview, 31–32
using binary and comparison 
operators together, 36–37
while
loops, 45–49
folders
absolute vs. relative paths, 175–176
backing up to ZIP file, 209–212
creating new ZIP file, 211
figuring out ZIP filename, 
210–211
walking directory tree, 211–212
backslash vs. forward slash, 174–175
copying, 198–199
creating, 176
current working directory, 175
defined, 173–174
deleting permanently, 200–201
deleting using 
send2trash
module, 
201–202
moving, 199–200
os.path
module
absolute paths in, 177–179
file sizes, 179–180
folder contents, 179–180
overview, 177
path validity, 180
relative paths in, 177–179
renaming, 199–200
walking directory trees, 202–203
Font
objects, 282–283
font styles, in Excel spreadsheets, 
282–284
for
loops
overview, 53–56
using dictionary items in, 108
using lists with, 86
format
attribute, 392
format_description
attribute, 392
formData
list, 434
form filler project, 430–437
overview, 430–431
radio buttons, 435–436
select lists, 435–436
setting up coordinates, 432–434
steps in process, 431
submitting form, 436–437
typing data, 434–435
Documents you may be interested
Documents you may be interested