Python Edit Simple Text File

Read a single txt file and indent every paragraph. myReader.py def getText( filePath ): with open( filePath ) as file: content = file.read() paragraphs = content.split( ‘\n’ ) file.close() newContent = “” for para in paragraphs: newContent = newContent + ” ” + para + “\n” return newContent main.py import Read more…

Use Python To Handle Simple PDF Edit Tasks

The article shows a few simple examples which use python to edit PDF. Copy And Encrypt PDF Just copy an existing PDF and generate a new file which is encrypted import PyPDF2 fileName = “/Users/weiyang/Desktop/Test.pdf” newFileName = “/Users/weiyang/Desktop/NewTest.pdf” file = open( fileName, ‘rb’ ) reader = PyPDF2.PdfFileReader( file ) writer Read more…

VTK Rotate Cone With Ring

A few macros we need in our project are in the following code snippet. They can make our project cleaner. #define vtkPtr( var, className ) vtkSmartPointer<className> var = \ vtkSmartPointer<className>::New() #define CPP_SET_MACRO(name,type) \ void Set##name(type _arg) \ { \ if (this->name != _arg) \ { \ this->name = _arg; \ Read more…

Tex To PDF
: convert the Latex file which suffix is tex to a PDF file

X