Ios 从html转换为pdf时,https图像链接不会以pdf格式显示

Ios 从html转换为pdf时,https图像链接不会以pdf格式显示,ios,swift,uiwebview,swift3,Ios,Swift,Uiwebview,Swift3,https图像链接未显示在pdf中,但http图像链接在将html转换为pdf时显示在pdf中。但在UIWebview中,我可以看到两者的图像,有人能帮忙吗 让logoImageURL=”https://firebasestorage.googleapis.com/v0/b/getbilleasy1.appspot.com/o/Images%2F1F057F2D-BF61-4EAB-8D0A-D286BEA957C9.png?alt=media&token=95bbd8e7-b12d-4d8f

https图像链接未显示在pdf中,但http图像链接在将html转换为pdf时显示在pdf中。但在UIWebview中,我可以看到两者的图像,有人能帮忙吗

让logoImageURL=”https://firebasestorage.googleapis.com/v0/b/getbilleasy1.appspot.com/o/Images%2F1F057F2D-BF61-4EAB-8D0A-D286BEA957C9.png?alt=media&token=95bbd8e7-b12d-4d8f-beda-e911aa3f493f“

让logoImageURL=”http://www.alertinfo.in/wp-content/uploads/2016/12/Putin-behind-Trump-win-324x160.jpg“
我正在尝试两个链接

`导入UIKit

类InvoiceComposer:NSObject{

let pathToInvoiceHTMLTemplate = Bundle.main.path(forResource: "invoice", ofType: "html")

let pathToSingleItemHTMLTemplate = Bundle.main.path(forResource: "single_item", ofType: "html")

let pathToLastItemHTMLTemplate = Bundle.main.path(forResource: "last_item", ofType: "html")
let senderInfo = UserDefaults.standard.object(forKey: "COMPANYDETAILSPDF") as? String




let dueDate = ""

let paymentMethod = "Cash"
//让logoImageURL=UserDefaults.standard.object(forKey:“LOGO”)作为?字符串 var Image\u url:String! 让logoImageURL=“”

//让logoImageURL=“” var发票编号:字符串

var pdfFilename: String!
  var invoices: [[String: AnyObject]]!

override init() {
    super.init()
}


func renderInvoice(invoiceNumber: String,invoiceDate: String,  recipientInfo: String,  totalAmount: String,items: [[String: String]]) -> String! {

    self.invoiceNumber = invoiceNumber

    do {
        // Load the invoice HTML template code into a String variable.
        var HTMLContent = try String(contentsOfFile: pathToInvoiceHTMLTemplate!)

        // Replace all the placeholders with real values except for the items.
        // The logo image.
        HTMLContent = HTMLContent.replacingOccurrences(of: "#LOGO_IMAGE#", with: logoImageURL)

        // Invoice number.
        HTMLContent = HTMLContent.replacingOccurrences(of: "#INVOICE_NUMBER#", with: invoiceNumber)

        // Invoice date.
        HTMLContent = HTMLContent.replacingOccurrences(of: "#INVOICE_DATE#", with: invoiceDate)

        // Due date (we leave it blank by default).
        HTMLContent = HTMLContent.replacingOccurrences(of: "#DUE_DATE#", with: dueDate)

        // Sender info.
        HTMLContent = HTMLContent.replacingOccurrences(of: "#SENDER_INFO#", with: senderInfo!)

        // Recipient info.
        print(recipientInfo)
        HTMLContent = HTMLContent.replacingOccurrences(of: "#RECIPIENT_INFO#", with: recipientInfo.replacingOccurrences(of: "\n", with: "<br>"))

        // Payment method.
        HTMLContent = HTMLContent.replacingOccurrences(of: "#PAYMENT_METHOD#", with: paymentMethod)

        // Total amount.
        HTMLContent = HTMLContent.replacingOccurrences(of: "#TOTAL_AMOUNT#", with: totalAmount)

        // The invoice items will be added by using a loop.
        var allItems = ""

        // For all the items except for the last one we'll use the "single_item.html" template.
        // For the last one we'll use the "last_item.html" template.

        print(items.count)
        for i in 0..<items.count {
            var itemHTMLContent: String!

            // Determine the proper template file.
            if i != items.count - 1 {
                itemHTMLContent = try String(contentsOfFile: pathToSingleItemHTMLTemplate!)
            }
            else {
                itemHTMLContent = try String(contentsOfFile: pathToLastItemHTMLTemplate!)
            }

            // Replace the description and price placeholders with the actual values.
            itemHTMLContent = itemHTMLContent.replacingOccurrences(of: "#ITEM_DESC#", with: items[i]["item"]!)

            // Format each item's price as a currency value.
            let formattedPrice = items[i]["price"]!
            itemHTMLContent = itemHTMLContent.replacingOccurrences(of: "#PRICE#", with: formattedPrice)

            // Add the item's HTML code to the general items string.
            allItems += itemHTMLContent
        }

        // Set the items.
        HTMLContent = HTMLContent.replacingOccurrences(of: "#ITEMS#", with: allItems)



        // The HTML code is ready.
        return HTMLContent

    }
    catch {
        print("Unable to open and use HTML template files.")
    }

    return nil
}


func exportHTMLContentToPDF(HTMLContent: String) {
    let printPageRenderer = CustomPrintPageRenderer()

    let printFormatter = UIMarkupTextPrintFormatter(markupText: HTMLContent)
    printPageRenderer.addPrintFormatter(printFormatter, startingAtPageAt: 0)

    let pdfData = drawPDFUsingPrintPageRenderer(printPageRenderer: printPageRenderer)

    pdfFilename = "\(AppDelegate.getAppDelegate().getDocDir())/Invoice\(invoiceNumber!).pdf"

    UserDefaults.standard.set(pdfFilename, forKey:"PDFFILENAME")
    UserDefaults.standard.synchronize()
    pdfData?.write(toFile: pdfFilename, atomically: true)

    print(pdfFilename)


}


func drawPDFUsingPrintPageRenderer(printPageRenderer: UIPrintPageRenderer) -> NSData! {
    let data = NSMutableData()

    UIGraphicsBeginPDFContextToData(data, CGRect.zero, nil)

    UIGraphicsBeginPDFPage()

    printPageRenderer.drawPage(at: 0, in: UIGraphicsGetPDFContextBounds())

    UIGraphicsEndPDFContext()

    return data
}
var-pdfFilename:String!
var发票:[[String:AnyObject]]!
重写init(){
super.init()
}
func renderInvoice(发票编号:String,发票日期:String,收件人信息:String,合计金额:String,项目:[[String:String]])->String{
self.invoiceNumber=invoiceNumber
做{
//将发票HTML模板代码加载到字符串变量中。
var HTMLContent=try String(contentsOfFile:pathtoincehtmltemplate!)
//将除项目外的所有占位符替换为实际值。
//标志图像。
HTMLContent=HTMLContent.replacingOccurrences(of:“#LOGO#u IMAGE#”,with:logoImageURL)
//发票号码。
HTMLContent=HTMLContent.replacingOccurrences(of:#发票#编号#),带:发票编号)
//发票日期。
HTMLContent=HTMLContent.replacingOccurrences(of:#发票#日期#),带:发票日期)
//到期日(我们默认为空)。
HTMLContent=HTMLContent.replacingOccurrences(of:“#到期日#”,with:dueDate)
//发件人信息。
HTMLContent=HTMLContent.replacingOccurrences(of:“#发送者#信息#”,with:senderInfo!)
//收件人信息。
打印(收件人信息)
HTMLContent=HTMLContent.replacingOccurrences(of:#RECIPIENT_INFO#),with:recipientInfo.replacingOccurrences(of:“\n”,with:
”) //付款方式。 HTMLContent=HTMLContent.replacingOccurrences(of:#PAYMENT#u METHOD#,with:paymentMethod) //总数。 HTMLContent=HTMLContent.replacingOccurrences(of:#TOTAL#u AMOUNT#,with:totalAmount) //将使用循环添加发票项。 var allItems=“” //对于除最后一个之外的所有项目,我们将使用“single_item.html”模板。 //对于最后一个,我们将使用“last_item.html”模板。 打印(项目数) 对于0..NSData中的i{ let data=NSMutableData() UIGraphicsBeginPDFContextToData(数据,CGRect.zero,nil) UIGraphicsBeginPDFPage() printPageRenderer.drawPage(位于:0,在:UIGraphicsGetPDFContextBounds()中) UIGraphicsSendPdfContext() 返回数据 }
}
`有什么解决方案吗?

显示您的检索结果使用详细信息更新您的问题。找到的答案转换为字节64。将什么转换为字节64??显示您的检索结果使用详细信息更新您的问题。找到的答案转换为字节64。将什么转换为字节64??