This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func createNewPDF() { | |
let pdfURL = NSURL(fileURLWithPath: self.selectedFile.fileURL); // URL of the existing PDF | |
if let pdf:CGPDFDocument = CGPDFDocument(pdfURL as CFURL) { // Create a PDF Document | |
let _newURL = "\(documentFolderPath)/\(self.selectedFile.name)"; // New URL to save editable PDF | |
let _url = NSURL(fileURLWithPath: _newURL) | |
var _mediaBox:CGRect = CGRect(x: 0, y: 0, width: pageWidth, height: pageHeight); // mediabox which will set the height and width of page | |
let _writeContext = CGContext(_url, mediaBox: &_mediaBox, nil) // get the context | |
//Run a loop to the number of pages you want |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void printActivityFlags(String activityName, Intent intent) { | |
Field[] declaredFields = Intent.class.getDeclaredFields(); | |
StringBuilder stringBuilder = new StringBuilder(activityName + " => "); | |
for (Field field : declaredFields) { | |
if (field.getName().startsWith("FLAG_")) { // Fetch all the flag names which start from "FLAG_" | |
try { | |
int flag = field.getInt(null); | |
if ((intent.getFlags() | flag) == intent.getFlags()) { // checking that flag is present or not. | |
stringBuilder.append(field.getName()); | |
stringBuilder.append("|"); |