How to use flexpaper+swftools large file paging transformation to achieve online preview

Source: Internet
Author: User
Tags httpcontext

Introduction

Before summarizing the online preview of several common solutions that can be poked here:

Http://www.cnblogs.com/wolf-sun/p/3569960.html

Http://www.cnblogs.com/wolf-sun/p/3525437.html

Http://www.cnblogs.com/wolf-sun/p/3574278.html

The customer suddenly gave a larger document, impressively collapsed, the project is Flexpaper+swftools way to achieve, found in pdf-"SWF, after the transfer of 100 pages, there will be problems, very helpless, the customer may upload the Word document problems, customer to the document, The page direction has horizontal, also has the portrait. There is no way to solve it.

Finally thought of a page of their turn, to tell the truth I was crazy, hundreds of pages of documents, smoke back just turn over, you are not crazy.

After thinking about using several other solutions, because the customer requested that the document could not be downloaded, be copied, want to have confidentiality, this demand, you want to keep secret, want to be safe, do not put on the net, other people just want, a screenshot of a picture, also can give your document buckle down, think that year, grind, I have done this thing, The questions are all from a screenshot of the Internet. Now think about it, it was really sb.

Single-page PDF transfer swf

Here is still the use of the demo:http://www.cnblogs.com/wolf-sun/p/3525437.html in this article

Then modify the methods pdf2swf and Getpagecount under the Psd2swfhelper class to change the private to public:

1///<summary>
2///PDF format to SWF
3///</summary>
4///<param name= "Pdfpath" >pdf file address </param>
5///<param name= "Swfpath" > post-generated swf file address </param>
6///<param name= "Beginpage" > Conversion start Page </param>
7///<param name= "EndPage" > Conversion End page </param>
8 public static bool Pdf2swf (string Pdfpath, string swfpath, int beginpage, int endpage, int photoquality)
9 {
//swftool, first install, and then copy the contents of the installation directory to the tools directory
One string exe = HttpContext.Current.Server.MapPath ("~/bin/tools/pdf2swf.exe");
Pdfpath = HttpContext.Current.Server.MapPath (Pdfpath);
Swfpath = HttpContext.Current.Server.MapPath (Swfpath);
if (! System.IO.File.Exists (EXE) | | ! System.IO.File.Exists (Pdfpath) | | System.IO.File.Exists (Swfpath))
15 {
return false;
17}
StringBuilder sb = new StringBuilder ();
SB. Append ("\" "+ Pdfpath +" "");
SB. Append ("O \" "+ Swfpath +" "");
SB. Append ("-S flashversion=9");
if (EndPage > Getpagecount (pdfpath)) EndPage = Getpagecount (Pdfpath);
SB. Append ("P" + "\" "+ Beginpage +" "+"-"+ EndPage +" "");
SB. Append ("-j" + photoquality);
String Command = sb. ToString ();
System.Diagnostics.Process p = new System.Diagnostics.Process ();
p.StartInfo.FileName = EXE;
P.startinfo.arguments = Command;
P.startinfo.workingdirectory = HttpContext.Current.Server.MapPath ("~/bin/");
P.startinfo.useshellexecute = false;
P.startinfo.redirectstandarderror = true;
P.startinfo.createnowindow = false;
P.start ();
P.beginerrorreadline ();
p.WaitForExit ();
P.close ();
Panax Notoginseng p.dispose ();
return true;
39}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.