Fastreport delphi можно ли заменить библиотеки acrobat reader на другие
I am using FastReports, and its resulting PDFs cannot be read correctly on iOS. Because iOS reads PDF/A, which FastReports doesn't support. This is apparently a known bug in FastReports 4.0, and it will be fixed in FastReports 5.0. However, 5.0 is a long way away, and has been in development for years by now.
So my simple solution - and I'd prefer a simple as possible solution, so I can remove it again once FastReports 5.0 is out - right now is to simply print the existing PDF to another PDF. Can this be done without installing a PDF printer on the system and just use Delphi?
And if not, is there a converter that accepts PDF files and outputs PDF files?
iOS devices are not limitted to PDF/A (BTW, which flavour? There are three PDF/A standards (1, 2, and 3) each of them offering two or three subtypes (a, b, and u)). Furthermore depending on the original PDF sensible conversion to PDF/A variants may be impossible, especially automatic conversion.
Can you post a sample PDF file generated with FastReport so we can take a look at it? I'm curious to see such a file.
In any case, PDF documents produced by FastReport are broken beyond belief. Their standard answer is that they cannot be viewed properly by other programs (like Firefox or Chrome preview) because they are not PDF/A, which is just bollocks. And their problems are not limited to fonts, but shapes as well. And they've been promising FR5 "any day soon" for years. Hopefully now that they have a bigger customer base they'll comply.
I think you could edit the question to be "How do I make FastReport generate a PDF that's viewable on iOS?" It would open the door to add your own answer about including the necessary fonts, but it wouldn't invalidate the other answers about re-generating the PDF.
7 Answers 7
Try using SynPDF. It's open source, and its results are good, while managing file size to a very acceptable level. It produces PDF/A docs.
A Fast Report export unit can be found in the following location:
+1 This is the IMHO best solution (at least using Open Source library, without the need of an external printer or conversion tool). You do not need to convert the PDF, but generate it using either PDF/A docs, either embed the fonts.
Even though I answered this question myself, I will take this as the accepted answer, because it is the best solution. It is the most forward solution, and probably be the one I eventually implement, when other issues with my program aren't as pressing. :)
Good to know! It's not difficult at all - you just make sure that, once you get the zip package with the needed files, go to the Synopse repository and download the latest version.
SynPDF seems to work fine. Only trouble seemed to be it collided with our system that uses RTTI, but we figured out to disable several features in SynPDF that wasn't interesting to us, which made it work.
I figured out my problem. To solution was to enable embedded fonts in the PDF, as I am using Tahoma and Arial, two fonts which are not available on iOS. I assume I had initially disabled this feature, to save filesize.
But I realise that I am comfortable sending a large file, even to iOS devices. So embedding fonts is the solution for me.
But I would like to give a mention to another answer by yms, which suggests using Helvetica (seeing as Tahoma and Arial are sans serif typefaces) as this is available on most platforms, including iOS. Or - perhaps as I gather from descriptions - part of the PDF engine rather than what lies on the platform.
However, despite this, I still think that to ensure that PDF is truly portable (P in PDF), one should embed all fonts, regardless of their availability. Because - who knows? - you might have some user with a PDF reader that doesn't. Oh and, it only counts for 'simple fonts', not CID fonts. CID fonts must be embedded.
In fact; as far as I understand Arial is an alias for Helvetica in the PDF spec, so it would load Helvetica instead; but it didn't work because it was a CID font.
FastReport VCL прежде всего – это генератор документов. Основываясь на этом, можно сделать предположение, что отображение или встраивание в отчет документов других форматов – излишне. Но запросы наших пользователей говорят об обратном. Многим приходится сталкиваться с задачей интеграции старых систем с новыми, и такая система может содержать уже готовые документы, которые необходимо подключить к новым отчетам. Проще говоря, встроить и отображать документ другого формата внутри отчета, добавляя к нему новые страницы или поля.
Для таких задач, в FastReport VCL 2021.3 мы добавили новый объект отчета TfrxPDFView. Данный объект использует библиотеку с открытым исходным кодом Pdfium и предназначен для отображения PDF документов внутри отчета. Вы можете собрать библиотеку самостоятельно или использовать готовые сборки из нашего инсталляционного пакета (frx_pdfium.dll и frx_pdfium_64.dll в папке Bin). При самостоятельной сборке необходимо переименовать библиотеку в frx_pdfium.dll для 32-х разрядной системы и в frx_pdfium_64.dll для 64-х разрядной системы. Для компиляции библиотеки вручную понадобится: Visual Studio и Google depot_tools. Более подробно можно посмотреть здесь и здесь.
Как было написано выше, собирать самостоятельно Pdfium не требуется, достаточно использовать уже готовые библиотеки из FastReport VCL, но, если ограничения безопасности в вашей компании требуют сборку всех исходных кодов на вашей стороне, вы можете использовать приведённые выше ссылки.
TfrxPDFView может отображать документ как на одной, так и на нескольких страницах, используя возможности движка для разрыва данных. Рассмотрим подробней, как использовать данный объект и какие возможности он имеет.
После установки последней версии FastReport VCL 2021.3 данный компонент должен появиться на палитре компонентов Delphi в разделе FastReport VCL.
Просто добавьте компонент TfrxPDFObject на форму приложения, чтобы использовать TfrxPDFView в Run-time. Если вы создали новый проект, добавьте компонент TfrxReport и двойным щелчком вызовите дизайнер отчетов.
Кликните на PDF Object в панели инструментов дизайнера и создайте объект на бэнде в отчете, как и любой другой объект отчета.
Объект создан. После этого должен появиться редактор, в который можно загрузить PDF документ.
TfrxPDFView позволяет выводить и многостраничные документы. Для этого у объекта есть специальные настройки.
Свойство DetailStretchMode отвечает за отображение содержимого внутри контейнера объекта и может принимать следующие значения:
- pdOneToOneStrongStretch – страница всегда растягивается, используя размеры объекта. Пропорции не соблюдаются.
- pdOneToOneNormalize - страница всегда растягивается с соблюдением пропорций оригинальной страницы в PDF документе.
- pdManyToOneNormalize – позволяет вместить несколько страниц в область объекта, соблюдая пропорции страниц в PDF документе.
Вперёд - сохраняем из нашего Delphi-приложения в PDF!
Да и "не архивный" PDF тоже имеет несколько версий (и вы можете выбрать, в какую сохранять)
Служебная информация, которая также пойдёт в PDF-файл: Название, автор, тема, ключевые слова (вы можете выкладывать PDF в веб, они отлично индексируются), средство создания PDF, производитель документа.
Безопасность - защита паролем документа от открытия (используется RC4). Возможность установить запрет на печать документа, изменение документа, копирование текста или графики, добавление или изменение текстовых заметок.
Настройка просмотрщика PDF в момент открытия документа: Скрыть панель инструментов, скрыть меню, скрыть окно пользовательского интерфейса, распахнуть окно просмотра, центрировать окно, растянуть под размер печати. Обычно при экспорте я использую параметры, выставленные разработчиками по умолчанию, но в этот раз пробежался по всем параметрам. Итак, если нам или нашим пользователям не нужно всё это богатство визуальное, то можно сразу
I recently discovered that the PDFs exported by the Fast Report's PDF export filter aren't displayed correctly in Mac OSX, iOS and Android devices.
Fast Report informed that their pdf implementation only support Windows and they can't say when the new implementation that they are working on will be available.
I also tried to use the Gnostice export filter, but their demo installer didn't work in Delphi XE and when I contacted them, they took 15 days to send me some attached dcus which also didn't work. So I'm searching for another option.
If you know or use a PDF export filter which works with Fast Report, please let me know.
November 2015: Fast Report now have PDF/A support, with this option enabled the PDFs are fine on all platforms.
October 2014 - Fast Report 5 still seems to generate "Windows-only" PDF. A production-ready solution for this problem would be a benefit for cross-platform developers, given that Fast Report is the report generator bundled with Delphi.
Here is a fresh example generated with the Fast Report 5 demo, displayed with Adobe Reader 11 on Android 4.4:
In OSX and iOS all the bold text aren't displayed and in Adobe Reader for Android the page is displayed blank.
@Fabio, about the bold text: Are you embedding your TTF fonts into the PDF? About the Android page: can you upload a sample PDF somewhere?
If I embed the Fonts it works in Mac OSX but still not in Android, but that's not an option, the pdfs become more than 1MB large (from 16kb). Also other pdfs with the same fonts (Arial for instance) works in Mac OSX, so its clearly a problem with the Fast Report's pdf.
@Fabio, to directly address the current question: I honestly doubt you'll find a 3rd party PDF export filter that works with Fast Report. Those export filters essentially get a reference to every control on the Fast Report document, and they need to do something with it. That means the potential export filter needs to be written in Delphi and needs to have very specific knowledge of how Fast Report works. This narrows down the potential market for the filter to Fast Report owners that need PDF and are not happy with the built-in filter. I personally doubt something like that exists.
Отображение многостраничного PDF документа
FastReport VCL позволяет выводить PDF документ в виде: одна страница PDF документа – одна страница в отчете, для каждой страницы в PDF документе.
Мы уже создали и загрузили PDF документ на бэнд заголовок отчета. Растянем его на всю страницу шаблона отчета, чтобы она выглядела примерно следующим образом:
Если сейчас нажать на просмотр отчета, то мы увидим только одну страницу, хотя, загружен многостраничный документ. Для вывода всех страниц в отчете нам нужно выполнить ряд действий.
- Шаг 1. Включить свойства AllowSplit и Stretched в True, у бэнда на котором располагается объект TfrxPDFView. Чтобы бэнд растягивался и разрывался.
- Шаг 2. Установить у объекта TfrxPDFView свойство StretchMode в smActualHeight или smMaxHeight, чтобы объект мог растягиваться.
Теперь можно запустить построение отчёта и взглянуть на результат.
FastReport VCL вывел все страницы PDF документа на страницах отчета.
Объект TfrxPDFView имеет и другие свойства. Свойство “Password“ устанавливает пароль, который используется PDF документом. А флаги свойства “DrawOptions” позволяют управлять отображением документа.
Теперь FastReport VCL умеет не только генерировать PDF документы, но и отображать их внутри отчета!
У некоторых людей возникает необходимость создавать PDF документы и при этом подписывать их цифровой подписью. Для решения этой потребности можно использовать FastReport VCL версий 2021.1 - 2021.4. Но что же делать, если нужно подписать документ в формате PDF более чем одной цифровой подписью? Да.
FastReport VCL прежде всего – это генератор документов. Основываясь на этом, можно сделать предположение, что отображение или встраивание в отчет документов других форматов – излишне. Но запросы наших пользователей говорят об обратном. Многим приходится сталкиваться с задачей интеграции .
Совсем недавно был выпущен FastReport FMX 2.8 в котором включена поддержка фреймворка FMXLinux. В этой статье я хочу описать процесс установки и требования на примере установки триальной версии FastReport FMX 2.8, Embarcadero RAD Studio 10.4.1, FmxLinux 1.52 из поставки GetIT и Ubuntu 20.04.1. Мы .
Возможно кто-то не знает, но стандарт PDF позволяет создавать заполняемые формы. То есть готовый документ можно редактировать прямо из просмотрщика. Чаще всего это применяется для анкет и различных бланков. Пользователь заполняет поля и отправляет документ по email или распечатывает. Сегодня мы рас.
В канун дня защиты информации мы решили подготовить материал по защите документов PDF. PDF-документы сегодня стали одним из мировых стандартов, будет не лишним понимать, как его защитить. От чего защищать документ PDF? От внесения несанкционированных изменений. От стороннего прочтения. Защ.
Часто бывает нужно объединить несколько документов в один (например PDF). Это могут быть несколько глав документации, разделы каталогов и т.д. Строго говоря, это бывает нужно сделать не только для PDF, просто сам по себе формат не предполагает редактирования и “склеивания” без спецсредст.
Raspberry PI - миниатюрный одноплатный компьютер, работающий на процессоре ARM. Этот микрокомпьютер часто используется в качестве учебной платформы, в разработках встроенных решений, а также в качестве простой рабочей станции при подключении к нему монитора и клавиатуры. Для экспериментов использ.
Довольно часто надо получить PDF-документ из приложения на Pascal - будь то Delphi или Lazarus. Обычно рекомендуют использовать специализированные решения, конвертор в PDF (itext, Synopse PDF Engine, PowerPDF, HotPDF, PDF Creator Pilot, PDFtoolkit VCL, Debenu Quick PDF Library и так далее). Мы не бу.
Электронный документооборот уже давно является неотъемлемой частью нашей жизни. Все по достоинству оценили удобство таких документов – они не портятся от времени, их сложнее потерять, легко хранить и быстро передавать на любые расстояния. И хотя, еще не прошли времена заказных писем и бандерол.
Ни для кого ни секрет, что стандарт PDF позволяет создавать заполняемые формы. То есть готовый документ можно редактировать прямо из просмотрщика. Чаще всего это применяется для анкет и различных бланков. Пользователь заполняет поля и отправляет документ по email или распечатывает. В новой версии F.
6 Answers 6
Fast Report informed that their pdf implementation only support Windows and they can't say when the new implementation that they are working on will be available.
I'm not sure that should be taken literally, considering PDF is supposed to be a cross platform format. It more likely means they don't actually have the time, equipment or expertise to test with those platforms. The PDF export filter that I'm using is the one built into Fast Report! It surely has some bugs, but I managed to work around them. And I think that might also work for you: Start with a simple document that does export properly, start adding features until it brakes, then you know what brakes it and you'll know how to work around the problem.
From my experience, here's what got me into trouble:
- Rounded corners in the PDF document didn't look like the ones in the Fast Report preview. My fix: Found a combination of settings that made the exported PDF look exactly like the preview document. For me rounded corners were just a cosmetic feature, and with cosmetics there's no "One Look"; The alternative worked just fine. This might actually be fixed in the most recent version, but I didn't bother changing the document to test.
- Transparency issues and outline issues. When working with the Fast Report editor (and when looking at it's previews) it's easy to overlap objects. You don't see this because of the object opacity. When exporting to PDF overlapped objects somehow managed to "print" outlines, and it obviously looked ugly. My fix: pay closer attention to those objects, make sure they don't overlap or make sure they don't generate outlines if no outlines are supposed to be seen.
Also make sure you test using ADOBE Reader, on any of the given platforms. If it works with the Adobe reader but doesn't work with other readers, there might be a bug in the 3rd party reader!
Edit: Here (link) is a sample PDF document generated by my Fast Reports application. I have no idea what kinds of documents you generate, but in my book that's a mighty complex document. Notice the diagonal line that starts where the table data ends, notice the embedded images (bar code, stamp, signature).
I opened that document on the following mobile devices:
- iPad, running iOS: The document renders 90% ok. Images are not rendered at all, but they're not important to my document (and that's very likely a problem with the iOS reader). All the fancy colored lines and rounded corners are properly rendered. Some text is not properly rendered, and I'm pretty sure that didn't render because the "box" that contains it is too small for the contents. That most likely happens because I didn't embed the TTF fonts into the PDF and the Apple font on iOS didn't perfectly match the Microsoft font that was used on Windows.
- Samsung Galaxy S2, running Android 2.3: The document renders 100% correctly.
- Samsung Something(??), running Windows Mobile 6.5 and the FoxReader: The document is totally gibberish: pictures showed up but the spacing between letters was messed so bad it's impossible to read. I blame the reader, it's not Acrobat and it probably wanted to be "smart". And it broke it's teeth in my text encoding, because my text is not English.
About the PDF format: A document is "PDF" if it conforms to the standard, here's some Wikipedia info on that. In theory a PDF document should render exactly the same way any way you look at it, but there are forces at play that might work against this:
Создаём новое VCL приложение в Delphi
Добавляем с вкладки "FastReport" на форму компоненты TfrxReport, TfrxPDFExport и TButton.
Делаем двойной клик на TfrxReport, входим в FR Designer. Создаём новый отчёт (File - > New report). Добавляем TfrxMemoView c текстом "Test text" на MasterData1
Устанавливаем MasterData1.RowCount = 200 (Чтобы повторить строку 200 раз и сформировать отчёт на 3-4 страницы, поскольку наш пример не использует датасет), выходим из дизайнера и прописываем и прописываем обработчик OnClick для Button1:
В принципе, этого кода нам уже достаточно для полноценной работы, формирования отчёта и экспорта в PDF. Теперь в "design time" делаете документ любой сложности (можете подключить любые источники данных и взять информацию оттуда) - таблицы, списки, иллюстрации, карты, QR-коды - для этого просто не забываем в проект предварительно добавить соответствующие компоненты (а иначе их в "run time" просто не будет), композитные и многостраничные документы, с якорями, встроенными ссылками и оглавлением - да пожалуйста! И любого размера - одностраничную квитанцию, стостраничный каталог, годовой отчёт о передвижениях персонала всех работников завода на тысячи страниц.
Да, не забываем положить компонент экспорта PDF в наш проект! Запускаем и нажимаем на единственную кнопку на форме. Видим окно предварительного просмотра и кнопку экспорта в PDF
Читайте также: