From 1ae95677474ce139e6d6e7ca3febc1b36508db5b Mon Sep 17 00:00:00 2001 From: Philippe Houdoin Date: Tue, 25 Oct 2005 09:30:52 +0000 Subject: [PATCH] We *do* know for sure it's a PDF document, so let's set the MIME type ourself. In the process, we also add "Title" and "Creator" attributes to PDF files generated. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14507 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../print/drivers/pdf/source/PDFWriter.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/add-ons/print/drivers/pdf/source/PDFWriter.cpp b/src/add-ons/print/drivers/pdf/source/PDFWriter.cpp index bd89f23938..4a5ff865ba 100644 --- a/src/add-ons/print/drivers/pdf/source/PDFWriter.cpp +++ b/src/add-ons/print/drivers/pdf/source/PDFWriter.cpp @@ -232,7 +232,7 @@ PDFWriter::EndJob() } #endif fImageCache.Flush(); - + PDF_close(fPdf); REPORT(kDebug, 0, ">>>> PDF_close"); @@ -247,9 +247,13 @@ PDFWriter::EndJob() // -------------------------------------------------- void PDFWriter::SetAttribute(const char* name, const char* value) { - BFile* file = dynamic_cast(Transport()); + + if (!name || !value) + return; + + BFile * file = dynamic_cast(Transport()); if (file) { - + file->WriteAttr(name, B_STRING_TYPE, 0, value, strlen(value) + 1); } } @@ -264,6 +268,9 @@ PDFWriter::InitWriter() fState = NULL; fStateDepth = 0; + // Set MIME-type explicit + SetAttribute("BEOS:TYPE", "application/pdf"); + // pdflib scope: object /* const char* license_key; @@ -303,7 +310,7 @@ PDFWriter::InitWriter() REPORT(kDebug, 0, ">>>> PDF_open_mem"); PDF_open_mem(fPdf, _WriteData); // use callback to stream PDF document data to printer transport - + // pdflib scope: PDF_set_parameter(fPdf, "flush", "content");