有关如何在WPF Windows应用程序中显示PDF文件的任何想法?
我使用以下代码来运行浏览器,但该Browser.Navigate方法没有做任何事情!
WebBrowser browser = new WebBrowser();
browser.Navigate("http://www.google.com");
this.AddChild(browser); // this is the System.Windows.Window
Run Code Online (Sandbox Code Playgroud) 如何使用关联的DataSource为DataGridView设置自定义列名?
这是一些代码:
class Key
{
public string Value { get; }
public DateTime ExpirationDate { get; }
}
List<Key> keys = new List<Key>();
...// fill keys collection
DataGridView dataGridView = createAndInitializeDataGridView();
dataGridView.DataSource = keys;
Run Code Online (Sandbox Code Playgroud)
这为dataGridView提供了列名"Value"和"ExpirationDate".我应该如何继续将名称更改为"密钥"和"过期"?
我有一个UIView图像和一些按钮作为其子视图.我想用它renderInContext或其他方法得到它的"快照"图像.
[clefView.layer renderInContext:mainViewContentContext];
Run Code Online (Sandbox Code Playgroud)
如果我将它传递给我UIView(如上所述),那么我得到一个空白的位图.没有子项被渲染到位图中.
如果我传递了作为图像的子视图,那么我得到一个该位图的图像,并且,毫不奇怪,没有它的兄弟(按钮).
我有点希望renderInContext将图像和所有可见的孩子都渲染成位图.有没有人有任何想法如何做到这一点?
我一直在使用此代码取得巨大成功,以提取PDF的每个页面中找到的第一个图像.但是,由于未知原因,它现在无法使用某些新PDF.我已经使用了其他工具(Datalogics等),这些工具可以很好地利用这些新的PDF来提取图像.但是,如果我可以使用iTextSharp,我不想购买Datalogics或任何工具.任何人都可以告诉我为什么这段代码没有找到PDF中的图像?
Knowns:我的PDF每页只有1张图片,没有别的.
using iTextSharp.text;
using iTextSharp.text.pdf;
...
public static void ExtractImagesFromPDF(string sourcePdf, string outputPath)
{
// NOTE: This will only get the first image it finds per page.
PdfReader pdf = new PdfReader(sourcePdf);
RandomAccessFileOrArray raf = new iTextSharp.text.pdf.RandomAccessFileOrArray(sourcePdf);
try
{
for (int pageNumber = 1; pageNumber <= pdf.NumberOfPages; pageNumber++)
{
PdfDictionary pg = pdf.GetPageN(pageNumber);
PdfDictionary res = (PdfDictionary)PdfReader.GetPdfObject(pg.Get(PdfName.RESOURCES));
PdfDictionary xobj = (PdfDictionary)PdfReader.GetPdfObject(res.Get(PdfName.XOBJECT));
if (xobj != null)
{
foreach (PdfName name in xobj.Keys)
{
PdfObject obj = xobj.Get(name);
if (obj.IsIndirect())
{ …Run Code Online (Sandbox Code Playgroud) 我正在尝试在UITableViewController找到位置后重新加载数据.这也意味着在该viewDidLoad方法之后.我的类正在扩展UITableViewController这个界面:
@interface RootViewController : UITableViewController <UITableViewDelegate, UITableViewDataSource, CLLocationManagerDelegate>
Run Code Online (Sandbox Code Playgroud)
在实现中我尝试使用重新加载数据
[self.view reloadData];
Run Code Online (Sandbox Code Playgroud)
reloadData 似乎不是UITableViewController或视图的方法,因为我收到一个错误:
Messages without a matching method signature will be assumed to return 'id' and accept '...' as arguments
Run Code Online (Sandbox Code Playgroud)
有人可以发一些代码,如何重新加载像我的情况扩展的表视图?
我想从网址下载pdf文件.为了查看pdf文件,我使用了以下代码.
File file = new File("/sdcard/example.pdf");
if (file.exists()) {
Uri path = Uri.fromFile(file);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(path, "application/pdf");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
try {
startActivity(intent);
}
catch (ActivityNotFoundException e) {
Toast.makeText(OpenPdf.this, "No Application Available to View PDF",
Toast.LENGTH_SHORT).show();
}
}
Run Code Online (Sandbox Code Playgroud)
它正在工作,但我如何从URL(例如http://.../example.pdf)获取pdf文件.我想从这个网址下载 pdf文件.请帮我.提前致谢.
我正在尝试生成一个字母,留下一个空白点然后在其顶部粘贴地址,具体取决于信封窗口的位置.
所以我开始这样做:
Document doc = new Document(PageSize.LETTER, 72, 72, 72, 72);
var w = PdfWriter.GetInstance(doc, output);
Font font = FontFactory.GetFont("arial", 10);
doc.Open();
doc.Add(new Paragraph("date", font) { SpacingAfter = 5 });
doc.Add(new Paragraph("\n\n\n\n\n\n", font));//empty spot
doc.Add(new Paragraph("long\n paragraph\ns panning\ multiple\n lines\n", font) { SpacingAfter = 5 });
doc.Add(new Paragraph("long\n paragraph\ns panning\ multiple\n lines\n", font) { SpacingAfter = 5 });
doc.Add(new Paragraph("long\n paragraph\ns panning\ multiple\n lines\n", font) { SpacingAfter = 5 });
doc.Add(new Paragraph("long\n paragraph\ns panning\ multiple\n lines\n", font) { SpacingAfter = …Run Code Online (Sandbox Code Playgroud) 我有一个从扫描软件生成的pdf.pdf每页有1个TIFF图像.我想从每个页面中提取TIFF图像.
我正在使用iTextSharp并且我已经成功找到了图像,并且可以从该PdfReader.GetStreamBytesRaw方法中获取原始字节.问题是,正如我之前发现的那样,iTextSharp不包含PdfReader.CCITTFaxDecode方法.
还有什么我知道的?即使没有iTextSharp,我也可以在记事本中打开pdf并找到流,/Filter /CCITTFaxDecode我知道/DecodeParams它正在使用CCITTFaxDecode组4.
有没有人知道如何从我的pdf中获取CCITTFaxDecode过滤图像?
干杯,卡胡
我正在尝试使用以下代码获取位图上下文:
GContextRef MyCreateBitmapContext (int pixelsWide, int pixelsHigh)
{
CGContextRef context = NULL;
CGColorSpaceRef colorSpace;
void * bitmapData;
int bitmapByteCount;
int bitmapBytesPerRow;
bitmapBytesPerRow = (pixelsWide * 4); // 1
bitmapByteCount = (bitmapBytesPerRow * pixelsHigh);
colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);// 2
bitmapData = malloc( bitmapByteCount ); // 3
if (bitmapData == NULL)
{
fprintf (stderr, "Memory not allocated!");
return NULL;
}
context = CGBitmapContextCreate (bitmapData, // 4
pixelsWide,
pixelsHigh,
8, // bits per component
bitmapBytesPerRow,
colorSpace,
kCGImageAlphaPremultipliedLast);
if (context== NULL)
{
free (bitmapData); // …Run Code Online (Sandbox Code Playgroud) iphone ×3
itextsharp ×3
c# ×2
image ×2
pdf ×2
.net ×1
android ×1
cocoa ×1
colors ×1
datagridview ×1
datasource ×1
download ×1
extract ×1
rendering ×1
tiff ×1
uitableview ×1
uiview ×1
winforms ×1
wpf ×1