Only problem at printing using printer
19 views (last 30 days)
Show older comments
qrCodeImagePath = 'qr.png';
% Read the QR code image
qrCodeImage = imread(qrCodeImagePath);
% Display the QR code image
imshow(qrCodeImage);
title('QR code');
% Adjust figure size to paper size
set(gcf,'PaperPositionMode','auto');
% Set paper orientation to landscape
set(gcf,'PaperOrientation','landscape');
% Specify printer
printerName = '-PTP518G';
% Print the QR code image to the printer
print(printerName, '-r300')
This is the Matlab script all is ok just at the printing part then popped out the warning below.
Warning: The figure is too large for the page and will be cut off. Resize the figure, adjust the output size by setting the figure's PaperPosition property, use the 'print'
command with either the '-bestfit' or '-fillpage' options, or use the 'Best fit' or 'Fill page' options on the 'Print Preview' window.
> In validate (line 146)
In print (line 67)
In qrcode (line 20)
0 Comments
Answers (1)
Walter Roberson
on 24 Aug 2023
The qr.png image that you displayed occupies more than about 8 inches wide when displayed. When you ask to print that, the settings you have are that it should keep that screen width -- but since that is wider than the size of the printer paper, that it should deal with that by cutting off part of the image.
If you want the image to be automatically rescaled to fit the size of the paper, then use
print(printerName, '-r300', '-bestfit')
2 Comments
Walter Roberson
on 25 Aug 2023
"bestfit" preserves aspect ratio; "fillpage" does not preserve aspect ratio.
See Also
Categories
Find more on Printing and Saving in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!