fix(pdf): change document page format to Media Carta Vertical (5.5x8.5 inches)

This commit is contained in:
=
2026-09-21 17:21:00 -04:00
parent f92ac1b06c
commit 7791fe9bc3
5 changed files with 37 additions and 42 deletions
@@ -6,8 +6,8 @@ import 'package:pdf/widgets.dart' as pw;
import 'package:printing/printing.dart';
class InsuranceAuthPdfService {
/// Genera el documento PDF de Autorización de Seguro en formato Media Carta Horizontal
/// (8.5 x 5.5 pulgadas / 612 x 396 pt), idéntico a AlfaMedical.
/// Genera el documento PDF de Autorización de Seguro en formato Media Carta Vertical
/// (5.5 x 8.5 pulgadas / 396 x 612 pt).
static Future<Uint8List> buildInsuranceAuthPdf({
required String doctorName,
required String specialty,
@@ -28,16 +28,15 @@ class InsuranceAuthPdfService {
final pdf = pw.Document(title: 'Autorización de seguro - $patientName');
final formattedDate = DateFormat('dd/MM/yyyy').format(date ?? DateTime.now());
// Formato exacto e idéntico a AlfaMedical (ReportLab):
// pagesize = (8.5*inch, 5.5*inch)
// leftMargin = 72, rightMargin = 72, topMargin = 18, bottomMargin = 18.
// Formato Media Carta Vertical (5.5 x 8.5 pulgadas / 396 x 612 pt):
// Margen equilibrado de media pulgada (36 pt) a los lados y 20 pt vertical
const pageFormat = PdfPageFormat(
8.5 * PdfPageFormat.inch,
5.5 * PdfPageFormat.inch,
marginLeft: 72,
marginRight: 72,
marginTop: 18,
marginBottom: 18,
8.5 * PdfPageFormat.inch,
marginLeft: 36,
marginRight: 36,
marginTop: 20,
marginBottom: 20,
);
// Tipografías estándar con fallback a fuentes base PDF si no hay conexión a internet
@@ -6,8 +6,8 @@ import 'package:pdf/widgets.dart' as pw;
import 'package:printing/printing.dart';
class PrescriptionPdfService {
/// Genera el documento PDF de la receta médica en formato Media Carta Horizontal
/// (8.5 x 5.5 pulgadas / 612 x 396 pt).
/// Genera el documento PDF de la receta médica en formato Media Carta Vertical
/// (5.5 x 8.5 pulgadas / 396 x 612 pt).
static Future<Uint8List> buildPrescriptionPdf({
required String doctorName,
required String specialty,
@@ -24,17 +24,15 @@ class PrescriptionPdfService {
final pdf = pw.Document(title: 'Receta Médica - $patientName');
final formattedDate = DateFormat('dd/MM/yyyy').format(date ?? DateTime.now());
// Formato exacto e idéntico a AlfaMedical:
// Media Carta Horizontal (8.5 x 5.5 pulgadas / 612 x 396 pt)
// Márgenes idénticos a AlfaMedical (ReportLab):
// leftMargin = 72, rightMargin = 72, topMargin = 18, bottomMargin = 18.
// Formato Media Carta Vertical (5.5 x 8.5 pulgadas / 396 x 612 pt):
// Margen equilibrado de media pulgada (36 pt) a los lados y 20 pt vertical
const pageFormat = PdfPageFormat(
8.5 * PdfPageFormat.inch,
5.5 * PdfPageFormat.inch,
marginLeft: 72,
marginRight: 72,
marginTop: 18,
marginBottom: 18,
8.5 * PdfPageFormat.inch,
marginLeft: 36,
marginRight: 36,
marginTop: 20,
marginBottom: 20,
);
// Tipografías estándar con fallback a fuentes base PDF si no hay conexión a internet
@@ -6,8 +6,8 @@ import 'package:pdf/widgets.dart' as pw;
import 'package:printing/printing.dart';
class DepartmentReferralPdfService {
/// Genera el documento PDF de Referimiento a Departamento en formato Media Carta Horizontal
/// (8.5 x 5.5 pulgadas / 612 x 396 pt), idéntico a AlfaMedical.
/// Genera el documento PDF de Referimiento a Departamento en formato Media Carta Vertical
/// (5.5 x 8.5 pulgadas / 396 x 612 pt).
static Future<Uint8List> buildDepartmentReferralPdf({
required String doctorName,
required String specialty,
@@ -23,16 +23,15 @@ class DepartmentReferralPdfService {
final pdf = pw.Document(title: 'Referir a Departamento');
final formattedDate = DateFormat('dd/MM/yyyy').format(date ?? DateTime.now());
// Formato exacto e idéntico a AlfaMedical (ReportLab):
// pagesize = (8.5*inch, 5.5*inch)
// leftMargin = 72, rightMargin = 72, topMargin = 18, bottomMargin = 18.
// Formato Media Carta Vertical (5.5 x 8.5 pulgadas / 396 x 612 pt):
// Margen equilibrado de media pulgada (36 pt) a los lados y 20 pt vertical
const pageFormat = PdfPageFormat(
8.5 * PdfPageFormat.inch,
5.5 * PdfPageFormat.inch,
marginLeft: 72,
marginRight: 72,
marginTop: 18,
marginBottom: 18,
8.5 * PdfPageFormat.inch,
marginLeft: 36,
marginRight: 36,
marginTop: 20,
marginBottom: 20,
);
// Tipografías estándar con fallback a fuentes base PDF si no hay conexión a internet
@@ -6,8 +6,8 @@ import 'package:pdf/widgets.dart' as pw;
import 'package:printing/printing.dart';
class DoctorReferralPdfService {
/// Genera el documento PDF de Referimiento a Doctor (a) en formato Media Carta Horizontal
/// (8.5 x 5.5 pulgadas / 612 x 396 pt), idéntico a AlfaMedical.
/// Genera el documento PDF de Referimiento a Doctor (a) en formato Media Carta Vertical
/// (5.5 x 8.5 pulgadas / 396 x 612 pt).
static Future<Uint8List> buildDoctorReferralPdf({
required String doctorName,
required String specialty,
@@ -23,16 +23,15 @@ class DoctorReferralPdfService {
final pdf = pw.Document(title: 'Referir a Doctor (a)');
final formattedDate = DateFormat('dd/MM/yyyy').format(date ?? DateTime.now());
// Formato exacto e idéntico a AlfaMedical (ReportLab):
// pagesize = (8.5*inch, 5.5*inch)
// leftMargin = 72, rightMargin = 72, topMargin = 18, bottomMargin = 18.
// Formato Media Carta Vertical (5.5 x 8.5 pulgadas / 396 x 612 pt):
// Margen equilibrado de media pulgada (36 pt) a los lados y 20 pt vertical
const pageFormat = PdfPageFormat(
8.5 * PdfPageFormat.inch,
5.5 * PdfPageFormat.inch,
marginLeft: 72,
marginRight: 72,
marginTop: 18,
marginBottom: 18,
8.5 * PdfPageFormat.inch,
marginLeft: 36,
marginRight: 36,
marginTop: 20,
marginBottom: 20,
);
// Tipografías estándar con fallback a fuentes base PDF si no hay conexión a internet