fix(pdf): change document page format to Media Carta Vertical (5.5x8.5 inches)
This commit is contained in:
@@ -6,8 +6,8 @@ import 'package:pdf/widgets.dart' as pw;
|
|||||||
import 'package:printing/printing.dart';
|
import 'package:printing/printing.dart';
|
||||||
|
|
||||||
class InsuranceAuthPdfService {
|
class InsuranceAuthPdfService {
|
||||||
/// Genera el documento PDF de Autorización de Seguro en formato Media Carta Horizontal
|
/// Genera el documento PDF de Autorización de Seguro en formato Media Carta Vertical
|
||||||
/// (8.5 x 5.5 pulgadas / 612 x 396 pt), idéntico a AlfaMedical.
|
/// (5.5 x 8.5 pulgadas / 396 x 612 pt).
|
||||||
static Future<Uint8List> buildInsuranceAuthPdf({
|
static Future<Uint8List> buildInsuranceAuthPdf({
|
||||||
required String doctorName,
|
required String doctorName,
|
||||||
required String specialty,
|
required String specialty,
|
||||||
@@ -28,16 +28,15 @@ class InsuranceAuthPdfService {
|
|||||||
final pdf = pw.Document(title: 'Autorización de seguro - $patientName');
|
final pdf = pw.Document(title: 'Autorización de seguro - $patientName');
|
||||||
final formattedDate = DateFormat('dd/MM/yyyy').format(date ?? DateTime.now());
|
final formattedDate = DateFormat('dd/MM/yyyy').format(date ?? DateTime.now());
|
||||||
|
|
||||||
// Formato exacto e idéntico a AlfaMedical (ReportLab):
|
// Formato Media Carta Vertical (5.5 x 8.5 pulgadas / 396 x 612 pt):
|
||||||
// pagesize = (8.5*inch, 5.5*inch)
|
// Margen equilibrado de media pulgada (36 pt) a los lados y 20 pt vertical
|
||||||
// leftMargin = 72, rightMargin = 72, topMargin = 18, bottomMargin = 18.
|
|
||||||
const pageFormat = PdfPageFormat(
|
const pageFormat = PdfPageFormat(
|
||||||
8.5 * PdfPageFormat.inch,
|
|
||||||
5.5 * PdfPageFormat.inch,
|
5.5 * PdfPageFormat.inch,
|
||||||
marginLeft: 72,
|
8.5 * PdfPageFormat.inch,
|
||||||
marginRight: 72,
|
marginLeft: 36,
|
||||||
marginTop: 18,
|
marginRight: 36,
|
||||||
marginBottom: 18,
|
marginTop: 20,
|
||||||
|
marginBottom: 20,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Tipografías estándar con fallback a fuentes base PDF si no hay conexión a internet
|
// 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';
|
import 'package:printing/printing.dart';
|
||||||
|
|
||||||
class PrescriptionPdfService {
|
class PrescriptionPdfService {
|
||||||
/// Genera el documento PDF de la receta médica en formato Media Carta Horizontal
|
/// Genera el documento PDF de la receta médica en formato Media Carta Vertical
|
||||||
/// (8.5 x 5.5 pulgadas / 612 x 396 pt).
|
/// (5.5 x 8.5 pulgadas / 396 x 612 pt).
|
||||||
static Future<Uint8List> buildPrescriptionPdf({
|
static Future<Uint8List> buildPrescriptionPdf({
|
||||||
required String doctorName,
|
required String doctorName,
|
||||||
required String specialty,
|
required String specialty,
|
||||||
@@ -24,17 +24,15 @@ class PrescriptionPdfService {
|
|||||||
final pdf = pw.Document(title: 'Receta Médica - $patientName');
|
final pdf = pw.Document(title: 'Receta Médica - $patientName');
|
||||||
final formattedDate = DateFormat('dd/MM/yyyy').format(date ?? DateTime.now());
|
final formattedDate = DateFormat('dd/MM/yyyy').format(date ?? DateTime.now());
|
||||||
|
|
||||||
// Formato exacto e idéntico a AlfaMedical:
|
// Formato Media Carta Vertical (5.5 x 8.5 pulgadas / 396 x 612 pt):
|
||||||
// Media Carta Horizontal (8.5 x 5.5 pulgadas / 612 x 396 pt)
|
// Margen equilibrado de media pulgada (36 pt) a los lados y 20 pt vertical
|
||||||
// Márgenes idénticos a AlfaMedical (ReportLab):
|
|
||||||
// leftMargin = 72, rightMargin = 72, topMargin = 18, bottomMargin = 18.
|
|
||||||
const pageFormat = PdfPageFormat(
|
const pageFormat = PdfPageFormat(
|
||||||
8.5 * PdfPageFormat.inch,
|
|
||||||
5.5 * PdfPageFormat.inch,
|
5.5 * PdfPageFormat.inch,
|
||||||
marginLeft: 72,
|
8.5 * PdfPageFormat.inch,
|
||||||
marginRight: 72,
|
marginLeft: 36,
|
||||||
marginTop: 18,
|
marginRight: 36,
|
||||||
marginBottom: 18,
|
marginTop: 20,
|
||||||
|
marginBottom: 20,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Tipografías estándar con fallback a fuentes base PDF si no hay conexión a internet
|
// 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';
|
import 'package:printing/printing.dart';
|
||||||
|
|
||||||
class DepartmentReferralPdfService {
|
class DepartmentReferralPdfService {
|
||||||
/// Genera el documento PDF de Referimiento a Departamento en formato Media Carta Horizontal
|
/// Genera el documento PDF de Referimiento a Departamento en formato Media Carta Vertical
|
||||||
/// (8.5 x 5.5 pulgadas / 612 x 396 pt), idéntico a AlfaMedical.
|
/// (5.5 x 8.5 pulgadas / 396 x 612 pt).
|
||||||
static Future<Uint8List> buildDepartmentReferralPdf({
|
static Future<Uint8List> buildDepartmentReferralPdf({
|
||||||
required String doctorName,
|
required String doctorName,
|
||||||
required String specialty,
|
required String specialty,
|
||||||
@@ -23,16 +23,15 @@ class DepartmentReferralPdfService {
|
|||||||
final pdf = pw.Document(title: 'Referir a Departamento');
|
final pdf = pw.Document(title: 'Referir a Departamento');
|
||||||
final formattedDate = DateFormat('dd/MM/yyyy').format(date ?? DateTime.now());
|
final formattedDate = DateFormat('dd/MM/yyyy').format(date ?? DateTime.now());
|
||||||
|
|
||||||
// Formato exacto e idéntico a AlfaMedical (ReportLab):
|
// Formato Media Carta Vertical (5.5 x 8.5 pulgadas / 396 x 612 pt):
|
||||||
// pagesize = (8.5*inch, 5.5*inch)
|
// Margen equilibrado de media pulgada (36 pt) a los lados y 20 pt vertical
|
||||||
// leftMargin = 72, rightMargin = 72, topMargin = 18, bottomMargin = 18.
|
|
||||||
const pageFormat = PdfPageFormat(
|
const pageFormat = PdfPageFormat(
|
||||||
8.5 * PdfPageFormat.inch,
|
|
||||||
5.5 * PdfPageFormat.inch,
|
5.5 * PdfPageFormat.inch,
|
||||||
marginLeft: 72,
|
8.5 * PdfPageFormat.inch,
|
||||||
marginRight: 72,
|
marginLeft: 36,
|
||||||
marginTop: 18,
|
marginRight: 36,
|
||||||
marginBottom: 18,
|
marginTop: 20,
|
||||||
|
marginBottom: 20,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Tipografías estándar con fallback a fuentes base PDF si no hay conexión a internet
|
// 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';
|
import 'package:printing/printing.dart';
|
||||||
|
|
||||||
class DoctorReferralPdfService {
|
class DoctorReferralPdfService {
|
||||||
/// Genera el documento PDF de Referimiento a Doctor (a) en formato Media Carta Horizontal
|
/// Genera el documento PDF de Referimiento a Doctor (a) en formato Media Carta Vertical
|
||||||
/// (8.5 x 5.5 pulgadas / 612 x 396 pt), idéntico a AlfaMedical.
|
/// (5.5 x 8.5 pulgadas / 396 x 612 pt).
|
||||||
static Future<Uint8List> buildDoctorReferralPdf({
|
static Future<Uint8List> buildDoctorReferralPdf({
|
||||||
required String doctorName,
|
required String doctorName,
|
||||||
required String specialty,
|
required String specialty,
|
||||||
@@ -23,16 +23,15 @@ class DoctorReferralPdfService {
|
|||||||
final pdf = pw.Document(title: 'Referir a Doctor (a)');
|
final pdf = pw.Document(title: 'Referir a Doctor (a)');
|
||||||
final formattedDate = DateFormat('dd/MM/yyyy').format(date ?? DateTime.now());
|
final formattedDate = DateFormat('dd/MM/yyyy').format(date ?? DateTime.now());
|
||||||
|
|
||||||
// Formato exacto e idéntico a AlfaMedical (ReportLab):
|
// Formato Media Carta Vertical (5.5 x 8.5 pulgadas / 396 x 612 pt):
|
||||||
// pagesize = (8.5*inch, 5.5*inch)
|
// Margen equilibrado de media pulgada (36 pt) a los lados y 20 pt vertical
|
||||||
// leftMargin = 72, rightMargin = 72, topMargin = 18, bottomMargin = 18.
|
|
||||||
const pageFormat = PdfPageFormat(
|
const pageFormat = PdfPageFormat(
|
||||||
8.5 * PdfPageFormat.inch,
|
|
||||||
5.5 * PdfPageFormat.inch,
|
5.5 * PdfPageFormat.inch,
|
||||||
marginLeft: 72,
|
8.5 * PdfPageFormat.inch,
|
||||||
marginRight: 72,
|
marginLeft: 36,
|
||||||
marginTop: 18,
|
marginRight: 36,
|
||||||
marginBottom: 18,
|
marginTop: 20,
|
||||||
|
marginBottom: 20,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Tipografías estándar con fallback a fuentes base PDF si no hay conexión a internet
|
// Tipografías estándar con fallback a fuentes base PDF si no hay conexión a internet
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
group('InsuranceAuthPdfService Tests', () {
|
group('InsuranceAuthPdfService Tests', () {
|
||||||
test('builds insurance auth pdf bytes with 8.5x5.5 inch format', () async {
|
test('builds insurance auth pdf bytes with media carta vertical format', () async {
|
||||||
final bytes = await InsuranceAuthPdfService.buildInsuranceAuthPdf(
|
final bytes = await InsuranceAuthPdfService.buildInsuranceAuthPdf(
|
||||||
doctorName: 'Dr. Luis A. Castro Sosa',
|
doctorName: 'Dr. Luis A. Castro Sosa',
|
||||||
specialty: 'Cirujano Urólogo',
|
specialty: 'Cirujano Urólogo',
|
||||||
|
|||||||
Reference in New Issue
Block a user