Caolán McNamara <caol...@redhat.com> 於 2022年5月26日 週四 下午6:33寫道:
> On Wed, 2022-05-25 at 21:42 +0800, Mark Hung wrote: > > here is another precondition: OutputDevice must be a printer (bPrt > > ==true) > > I think this requires that "Use printer metrics for document > formatting" is enabled to get to this path (tools, options, writer, > compatibility) which I think is "PrinterIndependantLayout" of > "disabled" in the config setting in the file format. > > If I create a new document, enable that "use printer metrics", add some > text and then use the "file, print" dialog and I get a hit of bPrt of > true. If you can reproduce the same I think that backtrace is valuable > to you to attempt a test, e.g. PrintOrPDFExport(pOut, ...) where I see > pOut->GetOutDevType() is OUTPUT_PRINTER (unotxdoc.cxx:2962) so I'd > guess something like > > a doc with "use printer metrics" enabled > ScopedVclPtrInstance<Printer> printer, > SwViewShell::PrintOrPDFExport(printer, ... > might get you where you want to go > > Now I can make both bPrt and bStretch true, if I enable "Use printer metrics for document formatting" and insert some code in PrintOrPDFExport to set ScaleX and ScaleY. I guess I can continue with that for my unit test. Interestingly, I didn't find any place it is set for the printer. I wonder if it is something that is no longer useful. In that case, we may remove the code completely. Thank you. -- Mark Hung