我正在使用EVO pdf DLL。 我已经完成了与pdf相关的所有功能。 有谁知道如何保存生成的PDF而不是下载。
这是我的代码我可以将该文件保存到我的位置,但 txt 格式文件正在生成。
这是我的代码
如果我做错了,请纠正我。
httpResponse.AddHeader("Content-Disposition", String.Format("attachment; filename='" + purchase_order_number + "'.pdf; size={0}", pdfBytes.Length.ToString()));
pdfConverter.SavePdfFromUrlToFile(host + "/pdf-purchase-order/Default.aspx/?in=" + purchase_order_number + "&vid=" + vendor_id + "&wid=" + WarehouseAddress, Server.MapPath("../backup111/"+purchase_order_number+".pdf"));
答案 0 :(得分:0)
如果您使用html创建pdf,则可以使用以下
SavePdfFromHtmlStringToFile(html, "PATH_TO_FILE");
我们确实需要更多信息才能给您答案。
答案 1 :(得分:0)
正如您所说,您成功生成了pdf,这意味着您可以在服务器上看到该pdf,然后您可以通过此代码将其保存在客户端计算机上
Response.ContentType = "Application/pdf";
Response.AppendHeader("Content-Disposition", "attachment; filename=Test_PDF.pdf");
Response.TransmitFile(Server.MapPath("~/Files/Test_PDF.pdf"));
Response.End();
Here是一个完整的演示。
答案 2 :(得分:0)
如果您使用的是evohtmltopdf.dll,则可以使用此功能:
int packet_size = packet.size();
JBuffer packet_buf = packet;
byte[] data = packet_buf.getByteArray(0, packet_size);
int[] data_int = new int[max_byte_read];
for (int k = 0; k<max_byte_read; k++) {
data_int[k] = data[k]&0xFF;
}
byte[] frame_control = new byte[2];
byte[] duration = new byte[2];
byte[] dest_ip = new byte[6];
byte[] src_ip = new byte[6];
byte[] bss_id = new byte[6];
byte[] seq_ctrl = new byte[2];
byte[] time_stamp = new byte[8];
byte[] beacon_interval = new byte[2];
byte[] capability_info = new byte[2];
byte[] tag_nr = new byte[1];
byte[] tag_len = new byte[1];
if (data_int[0]==0x80) {
// It's a beacon
System.out.printf("It's a beacon!\n");
frame_control = Arrays.copyOfRange(data, 0, 2);
duration = Arrays.copyOfRange(data, 2, 4);
dest_ip = Arrays.copyOfRange(data, 4, 10);
src_ip = Arrays.copyOfRange(data, 10, 16);
bss_id = Arrays.copyOfRange(data, 16, 22);
seq_ctrl = Arrays.copyOfRange(data, 22, 24);
time_stamp = Arrays.copyOfRange(data, 24, 32);
beacon_interval = Arrays.copyOfRange(data, 32, 34);
capability_info = Arrays.copyOfRange(data, 34, 36);
tag_nr = Arrays.copyOfRange(data, 36, 37);
tag_len = Arrays.copyOfRange(data, 37, 38);
int ss_id_len = tag_len[0];
byte[] ss_id = new byte[ss_id_len];
ss_id = Arrays.copyOfRange(data, 38, 38+ss_id_len);
System.out.printf("SSID: ");
for (byte b : ss_id) {
int c = b&0xFF;
System.out.printf("%s", (char) c);
}
System.out.println("");
}
else {
System.out.println("Not a beacon unfortunately");
}