Save($outputFile, SDFDoc::e_linearized); echo nl2br("Converted file: ".$inputFile."\n"); echo nl2br("to: ".$outputFile."\n"); } } function ConvertSpecificFormats() { global $input_path, $output_path; $pdfdoc = new PDFDoc(); $s1 = $input_path."simple-xps.xps"; $s2 = $input_path."simple-emf.emf"; // Convert the XPS document to PDF echo nl2br("Converting from XPS " .$s1."\n"); Convert::FromXps($pdfdoc, $s1 ); $outputFile = $output_path."xps2pdf v2.pdf"; $pdfdoc->Save($outputFile, SDFDoc::e_remove_unused); echo nl2br("Saved ".$outputFile."\n"); // Convert the two page PDF document to SVG echo nl2br("Converting pdfdoc to SVG\n"); $outputFile = $output_path."pdf2svg v2.svg"; Convert::ToSvg($pdfdoc, $outputFile); echo nl2br("Saved ".$outputFile."\n"); // Convert the PDF document to XPS echo nl2br("Converting pdfdoc to XPS\n"); $outputFile = $output_path."pdf2xps v2.xps"; Convert::ToXps($pdfdoc, $outputFile); echo nl2br("Saved ".$outputFile."\n"); // Convert the PNG image to XPS echo nl2br("Converting PNG to XPS\n"); $outputFile = $output_path."butterfly.xps"; Convert::ToXps($input_path."butterfly.png", $outputFile); echo nl2br("Saved ".$outputFile."\n"); // Convert PDF document to XPS echo nl2br("Converting PDF to XPS\n"); $outputFile = $output_path."newsletter.xps"; Convert::ToXps($input_path."newsletter.pdf", $outputFile); echo nl2br("Saved ".$outputFile."\n"); } // The first step in every application using PDFNet is to initialize the // library. The library is usually initialized only once, but calling // Initialize() multiple times is also fine. PDFNet::Initialize(); // Demonstrate Convert::ToPdf and Convert::Printer ConvertToPdfFromFile(); // Demonstrate Convert::[FromEmf, FromXps, ToEmf, ToSVG, ToXPS] ConvertSpecificFormats(); echo nl2br("Done.\n"); ?>