C#中没有打印/保存的PDF另存为 [英] PDF in C# without print/save save as

查看:334
本文介绍了C#中没有打印/保存的PDF另存为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我是新手,我正在尝试编写自己的pdf显示应用程序。

我想在我的阅读器中显示给客户端的一些pdf(显示应用程序) )但他一定不能打印/保存/保存等...

我正在使用visual studio 2015 C#windows应用程序。

我知道这个adobe主动X控制,但它仍然有一个条,让用户可以复制打印等...

我对显示文件不感兴趣 - 没什么特别的。

我害怕我把头埋在一个蜂箱中但又顽固我拒绝承认失败...

任何帮助都会非常感激

站立跪在地上,眼睛渐渐泪流满面...



我尝试了什么:



我看过苏门答腊/ Adob​​e / itextsharp

解决方案

看看 GitHub - jhabjan / Ghostscript.NET:Ghostsc ript.NET - 围绕Ghostscript库管理的包装器(32位& 64位) [ ^ ]



这是我提到的用于将PDF页面转换为图像,然后使用这些图像在MVC应用程序中显示文档的库。看起来我提供的链接可能是更好的选择,但我使用的方法可以在这里找到:



Ghostscript的简单C#包装器»matthew ephraim的博客 [ ^ ]



此方法依赖于/ bin目录中的 gsdll32.dll ,否则会出现运行时错误。将PDF转换为图像的调用如下: void GeneratePageThumb(string inputPath,string outputPath,int page,int dpix,int dpiy,int width = 0,int height = 0)



这里的想法是传递要转换的PDF,它将输出(outputPath)从PDF生成的所有图像。

Hi I am a newbie and I am trying to write my own pdf display application.
I have couple of pdf's that I want to show to a client on his pc in my reader (display application) but he must not be able to print /save/save as etc...
I am using visual studio 2015 C# windows application.
I am aware of the adobe active X control but it still has a "bar" that gives the user a way to copy print etc...
I am not interested in more than displaying the file - nothing fancy.
I'm afraid I have stuck my head in a beehive but being stubborn I refuse to admit defeat...
Any help will be sorely appreciated
Standing on knees and getting teary eyed now...

What I have tried:

I have looked at Sumatra/Adobe/itextsharp

解决方案

Take a look at GitHub - jhabjan/Ghostscript.NET: Ghostscript.NET - managed wrapper around the Ghostscript library (32-bit & 64-bit)[^]

This is a library that i mentioned that I used for converting pages of a PDF to images, then using those images to display the document in an MVC application. It looks like the link i provided may be a better option however the method I utilized is found here:

A Simple C# Wrapper for Ghostscript » matthew ephraim's blog[^]

This method is dependent upon having gsdll32.dll in your /bin directory otherwise you'll get run-time errors. The call to converting your PDF to images is the following void GeneratePageThumb(string inputPath, string outputPath, int page, int dpix, int dpiy, int width = 0, int height = 0)

The idea here that you pass in the PDF you want to convert and it will output (outputPath) all the images that were generated from your PDF.


这篇关于C#中没有打印/保存的PDF另存为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆