新版本的Chrome不包括-Mine类型-application/ pdf (通过量角器运行时),这将允许我在浏览器上查看pdf并通过量角器测试url,但它会自动下载并关闭选项卡。如果你通过手动打开铬并点击链接,它会打开下一个选项卡中的pdf,而不是自动下载。
手动运行chrome有以下扩展::
Chrome PDF Viewer (2 files)
Name: Chrome PDF Viewer
Version:
**Location: chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/
Type: BROWSER PLU
如何为ActiveRecord关联提供默认值?
例如,我有一个应用程序,其中Attachment是一个多态模型,用于存储任何其他模型的二进制数据。它有一个mime_type字段。
对于某些关联,mime_type是显而易见的。例如,
class Invoice < ActiveRecord::Base
has_one :pdf, # clearly this will be application/pdf
class_name: "Attachment",
as: :attached_to,
dependent: :destroy
end
我使用TCPDF作为附件发送pdf。我确实收到了电子邮件,所以电子邮件工作,但没有附件。
在电子邮件中,我收到了一条非常长的混乱消息。如果我删除$data (如下面的代码所示),消息的内容就会少得多,但仍然没有附件。
<?php
//This file create a pd contract agreement based on the client's detail.
// Include the main TCPDF library (search for installation path).
require_once('tcpdf_include.php
我正在生成pdf,并通过电子邮件发送附件的代码如下所示,我跳过了一些生成pdf的代码(不需要)。请检查代码:
//pdf generated not given avobe code of how it comes
$pdfdoc = $pdf->Output("confirmation-".$client_code.".pdf", "S");
$attachment = chunk_split(base64_encode($pdfdoc));
$to = $mail_to;
$from = "F
这几个小时来一直困扰着我。
// Using just straight up FINFO detects the mime type
$oFileInfo = new finfo( FILEINFO_MIME_TYPE );
$sMimeType = $oFileInfo -> file($_FILES['myfile']['tmp_name'] );
// $sMimeType == 'application/pdf';
我试图在我的pdf应用程序中使用wicked_pdf gem来生成rails。我的文件中有下面的代码。
gemfile
gem 'wicked_pdf'
gem 'wkhtmltopdf-binary'
和config/initializers/ and _pdf.rb文件中的
WickedPdf.config = {
# Path to the wkhtmltopdf executable: This usually isn't needed if using
# one of the wkhtmltopdf-binary family